Farmer John has received a shipment of large hay bales and placed them at various locations along the road leading to his barn. Unfortunately, he has completely forgotten that Bessie the cow is out grazing along the road, and she may now be trapped between the hay bales!
Each bale has a size S_j and a distinct position P_j along the one-dimensional road. Bessie starts at a location where there is no hay bale. She can move freely along the road, including up to the position of a bale, but she cannot pass through a bale. As an exception, if she runs in the same direction for units of distance, she builds up enough speed to break through and permanently eliminate any hay bale whose size is strictly less than . Of course, after breaking through a bale, she may have enough open space to make another run at a different bale and eliminate it as well.
Bessie can escape to freedom if she can eventually break through either the leftmost or the rightmost hay bale. Your task is to compute the total length of the road consisting of all real-valued starting positions from which Bessie cannot escape. For example, if Bessie cannot escape when starting anywhere between hay bales located at positions and , then this interval contributes a length of to the answer.
The first line contains an integer n~(1 \le n \le 4000).
Each of the next lines contains two integers describing a hay bale: its size S_j and its position P_j. All sizes and positions are between and 10^9.
Print one integer: the total length of the road from which Bessie cannot escape.
Example 1