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.
The first line contains a single integer N, the number of measurements Tomas made.
Each of the next N lines contains two integers Ti and Mi. Ti is the time at which Tomas took the i-th measurement, and Mi is its result: Mi is 1 if he had an internet connection at that moment, or 0 if he did not.
The measurements are given in increasing order of Ti.
Print a single integer: the longest time interval during which Tomas could have been without internet.