St Andrews Online Judge

String Quartet

By Kay Akashi

Time: 1000 ms
Memory: 256000 kB

The code judging system is only available during contests. Check out the github repo for test cases and solutions.

Please log in.

Problem Statement

Kay has 44 strings and lays them on an X-axis. String ii has its left end at x=lix = l_i and right end at x=rix = r_i. Now, find the length of line segment where all the 44 strings are laid.

Constraints

0li<ri100 \leq l_i \lt r_i \leq 10.

All the input values are given as integers.

Input

The input contains 44 lines, each of which has lil_i and rir_i.

Output

Output a single integer, the length of line segment where all 44 strings overlap.

Examples

Input

0 8
3 10
5 8
1 9

Output

3

Explanation

It is the line segment between x=5x = 5 and x=8x = 8 that satisfies the condition. Hence the length is 85=38 - 5 = 3.

Input

0 3
0 3
3 6
3 6

Output

0

Explanation

x=3x = 3 satisfies the condition. However, note that the point has a length of 00.

Input

0 1
2 3
4 5
6 7

Output

0