beecrowd | 1443
# Traffic Jam

**Timelimit: 1**

By Lucas Hermann Negri, UDESC Brasil

Marcos is a computer scientist who works in a transportation company, analyzing data from cargo trucks trips of the company and optimizing vehicle notes. Due to constants traffics jams involving the company vehicles, the company designed a new task to Marcos: compute the distance traveled by each vehicle in state of intense traffic jam. Marcos is very busy with other tasks at the company, and designed this task of calculating the traveled distance on trips to you, the new company trainee.

In a more specific way, the traveled distance of each trip must be calculated from the acceleration data during the trip. This data contains the time range that says when the driver stepped on the accelerator (constant acceleration of 1m/s², to a maximum speed of 10m/s), assuming that when the vehicle is not accelerating the driver will be stepping on the brake (stopped vehicle or braking with a constant slowdown of 2m/s²). The total traveled distance of the trip must be calculated from these time ranges, assuming that the vehicle is initially stopped.

The input is composed by several test cases. Each case corresponds to a trip and is started with a line contend an integer **N**, that says the amount of acceleration ranges of the vehicle during the trip. The end of input is determined by **N** = 0, that must not be processed.

Each of the next **N** lines contains two integers, **a** e **b**, designating the range time (in seconds) where the driver is with his foot on the accelerator (accelerated from the time t = **a** to t = **b**). In the first test case below (first trip) the driver stepped on the accelerator from the time t = 0s to t = 5s, stepped on the brake between t = 5s e t = 8s, accelerated from t = 8s to t = 15s, braked between t = 16s and t = 17s and accelerated to t = 50s. The traveled distance must be computed from t = 0s to the final second of the last acceleration range, in this case, from t = 0s to t = 50s.

Limits: 0 ≤ **N** ≤ 1000, being that each trip takes at most 30h.

The program must print, for each trip, one line containing the traveled distance in meters (with two digits after decimal point).

Sample Input | Sample Output |

3 |
358.75 200.00 |