program xmz;
type
asd=record
x,y:longint;
end;
var
a:array[1..5000]of asd;
f1,f2:text;
s:real;
i,n:longint;
bl:array[1..5000]of boolean;
procedure dep(aa:integer);
var j,k,min:integer;
ad:boolean;
begin
bl[aa]:=true;ad:=false;
for j:=1 to n do if not bl[j] then
begin
if not ad then begin min:=j;ad:=true;end;
if sqrt(sqr(a[j].x-a[aa].x)+sqr(a[j].y-a[aa].y))<sqrt(sqr(a[min].x-a[aa].x)+sqr(a[min].y-a[aa].y)) then
min:=j;
s:=s+sqrt(sqr(a[min].x-a[aa].x)+sqr(a[min].y-a[aa].y));
dep(min);
end;
end;
begin
assign(f1,'roadz.in');assign(f2,'roadz.out');
reset(f1);rewrite(f2);
read(f1,n);
for i:=1 to n do
read(f1,a[i].x,a[i].y);
dep(1);
write(f2,s:0:2);
close(f1);close(f2);
end.