Welcome to ZOJ
Information
Select Problem
Runs
Ranklist
ZOJ Problem Set - 1105
FatMouse's Tour

Time Limit: 2 Seconds      Memory Limit: 65536 KB

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).

Input Specification

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".

Output Specification

For each test case, your output should be one line with the time, in hours and minutes, required to tour the kingdom and return to the office. Round to the nearest minute.

Sample Input

0 0
0 0 10000 10000
5000 -10000 5000 10000
5000 10000 10000 10000
java

Output for Sample Input

3:55

Source: Zhejiang University Training Contest 2001
Submit    Status