// Arup Guha
// 2/17/2023
// Solution to COP 4516 Ind Contest 6 Problem: Underground Cables

using namespace std;

#include <iostream>
#include <iomanip>
#include <queue>
#include <cmath>

double prims(int v);
double dist(int i, int j);

class edge {
    public:
        int u;
        int v;
        double w;

        edge(int v1, int v2, double myw) {
            u = v1;
            v = v2;
            w = myw;
        }

        // Here, we define less than, which the priority queue uses.
        bool operator<(const edge& other) const {
            if (w != other.w)
                return w > other.w;
            return u > other.u;
        }
};

int n;
int pts[1000][2];

int main() {

    cin >> n;

    // Process cases.
    while (n != 0) {

        // Read in pts.
        for (int i=0; i<n; i++)
            cin >> pts[i][0] >> pts[i][1];
        
        cout << fixed << setprecision(2) << prims(0) << endl;

        // Get next.
        cin >> n;
    }

    return 0;
}

double prims(int v) {

    // Set up prims.

    // Added edges.
    bool used[1000];
    for (int i=0; i<n; i++) used[i] = false;

    // Priority Queue of edges to consider.
    priority_queue<edge> pq;
    used[v] = true;
    for (int i=0; i<n; i++) {
        if (i == v) continue;
        edge mine(v, i, dist(v, i));
        pq.push(mine);
    }

    // Bookkeeping.
    int numE = 0;
    double cost = 0;

    // Guaranteed to end on fully connected graph.
    while (numE < n-1) {

        edge cur = pq.top(); pq.pop();
        if (used[cur.u] && used[cur.v]) continue;

        // Added vertex.
        int nV = !used[cur.u] ? cur.u : cur.v;
        numE++;
        used[nV] = true;
        cost += cur.w;

        // Add new edges from i.
        for (int i=0; i<n; i++) {
            if (used[i]) continue;
            edge mine(nV, i, dist(nV, i));
            pq.push(mine);
        }
    }

    return cost;
}

// Returns distance from point i to point j.
double dist(int i, int j) {
    return sqrt( (pts[i][0]-pts[j][0])*(pts[i][0]-pts[j][0]) +
                 (pts[i][1]-pts[j][1])*(pts[i][1]-pts[j][1]));
}
