import std.stdio;
import std.algorithm;
import std.string;
import std.range;
import std.array;
import std.conv;
import std.complex;
import std.math;
import std.ascii;
import std.bigint;
import std.container;

double dot(int[] u, int[] v) {
	return u[0]*v[0]+u[1]*v[1];
}
double cross(int[] u, int[] v) {
	return u[0]*v[1]-u[1]*v[0];
}
double angle(int[] u, int[] v) {
	return 1-dot(u,v)/sqrt(dot(u,u))/sqrt(dot(v,v));
}

bool near(int[] p0, int[] p1, int[] p2, int[] p3) {
	int[2] v1 = p1[] - p0[];
	int[2] v2 = p2[] - p1[];
	int[2] v3 = p3[] - p1[];
	double a2 = angle(v1, v2);
	double a3 = angle(v1, v3);
	double eps = 1e-5;
	if(abs(a2-a3) < eps)
		return dot(v2, v2) < dot(v3,v3);
	else
		return a2<a3;
}

void main() {
	int n = to!int(readln().strip());
	while(n) {
		int[][] p;
		foreach(i; 0..n) {
			p ~= array(map!(to!int)(readln().strip().split()));
		}

		int[] p0 = [0,-1];
		int[] p1 = [0,0];
		double l = 0;
		while(n--) {
			int pi = 0;
			foreach(i; 1..p.length) {
				if(near(p0, p1, p[i], p[pi]))
					pi = cast(int)i;
			}
			int[2] v = p[pi][] - p1[];
			l += sqrt(dot(v,v));
			p0 = p1;
			p1 = p[pi];
			p = p[0..pi]~p[pi+1..$];
		}
		writefln("%.1f",l);

		n = to!int(readln().strip());
	}
}