As the Chairman of Association of Campus Mice (ACM), FatMouse is going out of his office to tour his kingdom. But with the International Cat Patrol Centers (ICPC) locating at every street, he has to carefully plan his trip so that it requires minimum time to visit everyone living at every street.

Assume that there are mice living at both sides of each street, yet FatMouse can only visit one side of a street in a single pass. He can turn any direction (including a U-turn) at any intersection, and can turn around at the end of any street. He goes at 20 km/h when visiting his people on the way (shaking hands and saying "hi"), and 50 km/h when passing a visited side of a street (since the cats must be awake by then).

The input file contains several test cases. Each test case starts from a line with two integers: the x,y coordinates of FatMouse's office (in metres). Up to 100 lines follow. Each gives the
coordinates (in metres) of the beginning and end of a street. All streets are
perfectly straight, with one side in each direction. It is possible to reach all streets
from the office.
Each test case is finished by a special word "java".

提交代码