Ural State University Problem Set Archive with Online Judge System

English
Russian
Online Judge
About
Submit Problem
Problem Set
Status (online)
Webboard
FAQ
Links
Photos
Authors
Register
Update your info
Authors ranklist
Online Contests
Current Contest
Scheduled Contests
Archive
Summary Ranklist Рейтинг ресурсов "УралWeb"


Language: English
Electric Path
Time Limit: 1 second
Memory Limit: 1000K

Background

  At the team competition of the 10th national student informatics Olympic, which is organized at Hanoi National University, there are N teams participating. Each team is assigned to work in a camp. On the map, it can be seen that the camps are positioned on the vertices of a convex polygon with N vertices: P1, P2,..., PN (the vertices are enumerated around the polygon in counter-clockwise order.) In order to achieve absolute safety providing electricity to the camps, besides a electric supplying system, the host organization set up a path from a reserved electricity generator (which is placed in one of the camps) to every camp once, and the path's total length is minimum.

Problem

Given the coordinates of the polygons' vertices (the camps' positions), determine the length of the electric path corresponding to the host organization's arrangement.

Input

  • The first line contains the positive integer N (1<=N<=200);
  • The ith line of the next N lines contains two real numbers xi, yi, separated by a space, with no more than 3 digits after the decimal points, are vertex Pi's coordinates on the plane (with i = 1,2,...,N). The length of the path connecting two vertex (xi, yi) and (xj, yj) is computed with the formula: sqrt((xi-xj)*(xi-xj)+(yi-yj)*(yi-yj))

Output

The first line (which is also the last line) contains real number L (written in real number format, with 3 digits after the decimal point), which is the total length of the electric path.

Sample Input

4
50.0  1.0
5.0  1.0
0.0  0.0
45.0  0.0

Sample Output

50.211


Problem Source: The competition for selecting the Vietnam IOI team.



Print     View Problem Statistics     Discuss     Submit

TIMUS © 2000. All rights reserved.