program cowties;
Type
fxz1=record x,y:integer;end;
fxz2=array[0..40] of fxz1;
fxz3=array[0..102] of fxz2;
var
cow:fxz3;
f1,f2:text;
min:real;
i,n,j:longint;
procedure sc(i:integer;ls:real);
var
j,k:longint;
begin
if i=n+1 then begin if ls<=min then min:=ls;end
else begin for j:=1 to cow[i][0].x do
for k:=1 to cow[i+1][0].x do
sc(i+1,ls+sqrt(sqr(cow[i+1][k].x-cow[i][j].x)+sqr(cow[i+1][k].y-cow[i][j].y)));
end;
end;
begin
assign(f1,'cowties.in');
assign(f2,'cowties.out');
reset(f1);rewrite(f2);
readln(f1,n);
for i:=1 to n do
begin
read(f1,cow[i][0].x);
for j:=1 to cow[i][0].x do
read(f1,cow[i][j].x,cow[i][j].y);
readln(f1);
end;
cow[n+1]:=cow[1];
min:=9999999;
sc(1,0);
writeln(f2,(100*min):0:0);
close(f1);close(f2);
end.