Farmer John received a shipment of N large hay bales (1≤N≤100000) and placed them at various points along the road that leads to his barn. He forgot that Bessie the cow was grazing along that road, so she may now be trapped between the bales.
Bale j has size Sj and sits at position Pj on the one-dimensional road. Bessie moves freely along the road and can walk right up to the position of a bale, but she cannot cross that position. There is one exception. If she runs in the same direction for a distance of D, she builds up enough speed to break through and permanently remove any bale whose size is strictly less than D. Removing a bale opens up more room to run, so she sometimes breaks further bales after that.
Bessie escapes if she eventually breaks through the leftmost bale or the rightmost bale. Compute the total length of the real-valued starting positions from which Bessie cannot escape.
The first line contains N. Each of the next N lines describes one bale with two integers, its size and then its position. Both values are between 1 and 109. All positions are distinct.
Print one integer, the length of the part of the road from which Bessie cannot escape.