Unification Day#2967

Unification Day

2 seconds
128 megabytes
Very easy

Byteland has cities, but not a single road. The king of the country, Waldemar de Bear, decided to remedy this situation. He plans to connect some cities with roads so that it is possible to reach any city from any other city using these roads. When construction is completed, the king will celebrate Unification Day.

Unfortunately, the treasury of Byteland is almost empty, so the king needs to save money by minimizing the total length of constructed roads.

Input

The first line contains the number (1 \le n \le 5000) — the number of cities in Byteland. Each of the next lines contains two integers x_i, y_i (-10000 \le x_i, y_i \le 10000) — the coordinates of the -th city. No two cities are located at the same point.

Output

Print the minimum total length of roads. Print the answer with an accuracy of at least 10^{-3}.

Examples

Example 1

Loading
Loading