By Kay Akashi
Kay has strings and lays them on an X-axis. String has its left end at and right end at . Now, find the length of line segment where all the strings are laid.
.
All the input values are given as integers.
The input contains lines, each of which has and .
Output a single integer, the length of line segment where all strings overlap.
0 8
3 10
5 8
1 9
3
It is the line segment between and that satisfies the condition. Hence the length is .
0 3
0 3
3 6
3 6
0
satisfies the condition. However, note that the point has a length of .
0 1
2 3
4 5
6 7
0