시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 0 0 0 0.000%

문제

A city wants to get rid of their unsightly power poles by moving their power cables underground. They have a list of points that all need to be connected, but they have some limitations. Their tunneling equipment can only move in straight lines between points, and they only have room for one underground cable at any location except at the given points so no two cables can cross.

Given a list of points, what is the least amount of cable necessary to make sure that every pair or points is connected, either directly, or indirectly through other points?

입력

There will be several test cases in the data file. Each test case will begin with an integer N (2 ≤ N ≤ 1, 000), which is the number of points in the city. On each of the next N lines will be two integers, X and Y (−1, 000 ≤ X, Y ≤ 1, 000), which are the (X, Y ) locations of the N points.

The data file will end with a line with a single 0.

출력

For each test case, output a line containing single real number, representing the least amount of cable the city will need to connect all of its points. Print this number with to two decimal places precision.

 

예제 입력

4
0 0
0 10
10 0
10 10
2
0 0
10 10
0

예제 출력

30.00
14.14

힌트