LearnPy Hub
← Arena
IntermediateRating 1200

Total Free Time

A working day runs from 0 to T. Meetings occupy intervals [s, e) and may overlap. Print how much time is free.

Input

T and n; then n lines 's e'.

Output

One integer.

Sample 1

Input
10 2
1 3
2 5
Output
6

Sample 2

Input
10 0
Output
10
solution.py
Output appears here
Total Free Time · Python Arena problem · LearnPy Hub