题目描述
Shrija's brother Vaibhav is a very mischievous boy . He has messed a lot of books of Shrija on floor . Now Shrija is very angry . Seeing her sister angry he promises to arrange them on N empty stacks numbered from 1 to N .
Shrija also felt that she should help her brother in arranging the books. So she gives Vaibhav a sequence of M instructions each of the form "A B", meaning that Vaibhav should add one new book to the top of each stack in the range A..B. For example, if Vaibhav is told "10 13", then he should add a book to each of the stacks 10, 11, 12, and 13.
After Vaibhav finishes stacking books according to the instructions, Shrija would like to know the median height of the N stacks i.e. the height of the middle stack if the stacks were to be arranged in sorted order (Assume N is odd, so median is unique). Please help Shrija in finding the answer .
Input
Line 1: Two space-separated integers, N M.
Lines 2 to 1+M: Each line contains one of Shrija's instructions in the
form of two space separated integers A B (1 <= A <= B <= N).
Output
Only 1 integer which is the required answer.
Constraints
1 ≤ N ≤ 100000
1 ≤ M ≤ 10000
Example
Input:
5 3
2 4
1 3
3 5
Output:
2
输入格式
见题面
输出格式
见题面