## DMOPC '14 Contest 6 P2 - Longest Tunnel

View as PDF

Points: 3 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Simon likes drilling tunnels parallel to the ground. Simon has drilled horizontal line tunnels. Each tunnel starts from and ends at . What is the length of the longest tunnel that Simon has dug?

#### Input Specification

The first line of input will contain the single integer .
For each of the next lines, line will contain two space-separated integer values and .

#### Output Specification

On one line, the length of the longest tunnel.

#### Sample Input

3
1 8
9 150
0 81

#### Sample Output

141