Underground Cables

Time limit1sMemory limit128 MB

Problem

A city wants to remove its unsightly power poles by moving the power cables underground. A set of points must all be connected, with some limitations: the tunneling equipment can only dig in straight lines between points, and there is room for only one cable at any location except at the given points, so no two cables may cross.

Given the points, find the least total length of cable needed so that every pair of points is connected, either directly or indirectly through other points.

Input

The input contains several test cases. Each test case begins with an integer $N$ ($2 \le N \le 1000$), the number of points. Each of the next $N$ lines has two integers $X$ and $Y$ ($-1000 \le X, Y \le 1000$), the coordinates of a point. Within a test case all points are distinct. The input ends with a line containing a single $0$.

Output

For each test case, output a single real number: the least total length of cable needed to connect all of the points. Print it with exactly two digits after the decimal point, rounded. Print each answer on its own line, and print no blank lines between answers.