Time Limit : 8 sec, Memory Limit : 65536 KB

Problem E: Hide-and-seek

Hide-and-seek is a childrenfs game. Players hide here and there, and one player called it tries to find all the other players.

Now you played it and found all the players, so itfs turn to hide from it. Since you have got tired of running around for finding players, you donft want to play it again. So you are going to hide yourself at the place as far as possible from it. But where is that?

Your task is to find the place and calculate the maximum possible distance from it to the place to hide.


The input contains a number of test cases.

The first line of each test case contains a positive integer N (N ≤ 1000). The following N lines give the map where hide-and-seek is played. The map consists of N corridors. Each line contains four real numbers x1, y1, x2, and y2, where (x1, y1 ) and (x2, y2 ) indicate the two end points of the corridor. All corridors are straight, and their widths are negligible. After these N lines, there is a line containing two real numbers sx and sy, indicating the position of it. You can hide at an arbitrary place of any corridor, and it always walks along corridors. Numbers in the same line are separated by a single space.

It is guaranteed that its starting position (sx, sy) is located on some corridor and linked to all corridors directly or indirectly.

The end of the input is indicated by a line containing a single zero.


For each test case, output a line containing the distance along the corridors from eiths starting position to the farthest position. The value may contain an error less than or equal to 0.001. You may print any number of digits below the decimal point.

Sample Input

0 0 3 3
0 4 3 1
1 1

Output for the Sample Input


Source: ACM-ICPC Japan Alumni Group Summer Camp 2006 , Day 2, Tokyo, Japan, 2006-09-23