I-Soar

Time limit1sMemory limit128 MB

Problem

The town meeting was not going well. "It's noisy," some residents complained. "It's ugly," others stated. "It's an eyesore," many agreed. "It's here," said the mayor, "and it's not going to go away."

The cause of all this furor was the new stretch of Interstate Highway that had just opened. Straight as an arrow, it ran along the entire northern edge of the town.

"Look," said the mayor, "we can reduce the noise and improve the view by planting trees and tall hedges along the road, but we don't have an unlimited budget. Luckily, much of the highway is already hidden by some of the buildings in our commercial district on the north. We'll see what we can do by planting in the visible gaps between the buildings."

Write a program to compute the total linear length of planting required to block the view of the Interstate for an observer looking straight north (orthogonal to the highway) from the southern side of the commercial district.

Input

The input consists of multiple data sets. The first line of each data set contains the length of the town border adjacent to the highway, given as a floating-point number $L$. A nonpositive value of $L$ signals the end of the input.

This line is followed by zero or more lines describing buildings in the commercial district. Each such line gives a pair of x-positions (floating-point numbers) representing the portion of the interstate whose view is occluded by that building. These positions use the same units as the border length, where $0$ denotes the western end of the border and $L$ the eastern end. The end of a data set is signaled by any pair $x_1, x_2$ with $x_1 > x_2$.

For every building line, $0 \le x_1 \le x_2 \le L$.

Output

For each data set, print one line in the form

The total planting length is ##

where ## is the total length of the Interstate visible between the buildings, printed to one decimal place.