Internet

No attempts yetTime limit1sMemory limit1024 MB

Problem

Tomas's internet connection is often unstable, and sometimes it drops out entirely. Tomas wants to know how long he might have to wait for a dropped connection to come back, so every now and then he checks whether he has an internet connection at that moment and writes it down.

Tomas remembers that he had a connection during both the first and the last measurement.

Help Tomas find the longest time he could possibly have gone without internet.

Input

The first line contains a single integer NN, the number of measurements Tomas made.

Each of the next NN lines contains two integers TiT_i and MiM_i. TiT_i is the time at which Tomas took the ii-th measurement, and MiM_i is its result: MiM_i is 11 if he had an internet connection at that moment, or 00 if he did not.

The measurements are given in increasing order of TiT_i.

Output

Print a single integer: the longest time interval during which Tomas could have been without internet.

Constraints

  • 2N10002 \le N \le 1000
  • 1Ti1061 \le T_i \le 10^6
  • Ti<Ti+1T_i < T_{i+1}