import std.stdio;
import std.ascii;
import std.range;
import std.array;
import std.functional;
import std.algorithm;
import std.conv;
import std.container;
import std.math;
import std.numeric;
import std.string;
import std.c.string;
import std.regex;
import std.typecons;

const EPS = 1e-19;

struct Point {
    double x, y;
    Point opBinary(string op)(in Point a) {
        static if (op == "-") {
            return Point(x - a.x, y - a.y);
        }
    }
}
double dot(in Point a, in Point b) {
    return a.x * b.x + a.y * b.y;
}
double dot2(in Point a, in Point b) {
    double d = dot(a, b);
    return d * d;
}
double cross(in Point a, in Point b) {
    return a.x * b.y - a.y * b.x;
}
double norm(in Point a) {
    return sqrt(a.x * a.x + a.y * a.y);
}
double norm2(in Point a) {
    return a.x * a.x + a.y * a.y;
}

void main() {
    int N;
    Point[] P;
    bool input() {
        scanf("%d\n", &N);
        if (N == 0) return false;
        P.clear;
        foreach (i; 0 .. N) {
            double x, y;
            scanf("%lf %lf\n", &x, &y);
            P ~= Point(x, y);
        }
        return true;
    }
    void solve() {
        auto c = Point(0, 0),
             v = Point(0, 1);
        auto used = new bool[N];
        double Ans = 0;
        while (true) {
            double min_t = double.max;
            int next;
            foreach (i; 0 .. N) {
                if (used[i]) continue;
                Point n = P[i] - c;
                double t = acos(dot(n, v) / (n.norm * v.norm));
                if (cross(n, v) < -EPS) t += PI;
                if (abs(t - min_t) < EPS && n.norm2 <= (P[next] - c).norm2) {
                    next = i;
                    min_t = t;
                } else if (t + 1e-19 < min_t) {
                    next = i;
                    min_t = t;
                }
            }
            if (min_t == double.max) break;
            used[next] = true;
            //writeln(next);
            Ans += (c - P[next]).norm;
            v = P[next] - c;
            c = P[next];
        }
        writefln("%.1f", Ans);
    }
    while (input) solve;
}