Problem: A root tree is a directed acyclic graph that contains one node (root), from which there is exactly one path to any other node.

A root tree is binary if each node has at most two outgoing arcs.

When a binary tree is painted on the plane, all arcs should be directed from top to bottom. That is, each arc going from u to v must meet the condition yu > yv.

You've been given the coordinates of all tree nodes. Your task is to connect these nodes by arcs so as to get the binary root tree and make the total length of the arcs minimum. All arcs of the built tree must be directed from top to bottom.

Input

The first line contains a single integer n (2 ≤ n ≤ 400) — the number of nodes in the tree. Then follow n lines, two integers per line: xi, yi (|xi|, |yi| ≤ 103) — coordinates of the nodes. It is guaranteed that all points are distinct.

Output

If it is impossible to build a binary root tree on the given points, print "-1". Otherwise, print a single real number — the total length of the arcs in the minimum binary tree. The answer will be considered correct if the absolute or relative error doesn't exceed 10 - 6. 

Examples

Input

3
0 0
1 0
2 1


Output

3.650281539872885


Input

4
0 0
1 0
2 1
2 0


Output

-1

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int mxN = 100005;
const int inf = 2e9;
struct Edgee {
  int to;
  double cost;
  int cap, flow, backEdge;
};
struct MCMF {
  int s, t, n;
  vector<Edgee> g[mxN];
  MCMF(int _s, int _t, int _n) { s = _s, t = _t, n = _n; }
  void addEdge(int u, int v, int cap, double cost) {
    Edgee e1 = {v, cost, cap, 0, (int)g[v].size()};
    Edgee e2 = {u, -cost, 0, 0, (int)g[u].size()};
    g[u].push_back(e1);
    g[v].push_back(e2);
  }
  pair<double, int> minCostMaxFlow() {
    int flow = 0;
    double cost = 0;
    vector<int> state(n), from(n), from_edge(n);
    vector<double> d(n);
    deque<int> q;
    while (true) {
      for (int i = 0; i < n; i++) state[i] = 2, d[i] = inf, from[i] = -1;
      state[s] = 1;
      q.clear();
      q.push_back(s);
      d[s] = 0;
      while (!q.empty()) {
        int v = q.front();
        q.pop_front();
        state[v] = 0;
        for (int i = 0; i < (int)g[v].size(); i++) {
          Edgee e = g[v][i];
          if (e.flow >= e.cap || d[e.to] <= d[v] + e.cost) continue;
          int to = e.to;
          d[to] = d[v] + e.cost;
          from[to] = v;
          from_edge[to] = i;
          if (state[to] == 1) continue;
          if (!state[to] || (!q.empty() && d[q.front()] > d[to]))
            q.push_front(to);
          else
            q.push_back(to);
          state[to] = 1;
        }
      }
      if (d[t] == inf) break;
      int it = t, addflow = inf;
      while (it != s) {
        addflow = min(addflow, g[from[it]][from_edge[it]].cap -
                                   g[from[it]][from_edge[it]].flow);
        it = from[it];
      }
      it = t;
      while (it != s) {
        g[from[it]][from_edge[it]].flow += addflow;
        g[it][g[from[it]][from_edge[it]].backEdge].flow -= addflow;
        cost += 1.0 * g[from[it]][from_edge[it]].cost * addflow;
        it = from[it];
      }
      flow += addflow;
    }
    return {cost, flow};
  }
};
int n;
double dis[1005][1005];
pair<int, int> a[1005];
int main() {
  cin >> n;
  int maxx = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].first >> a[i].second;
    maxx = max(maxx, a[i].second);
  }
  int c = 0;
  for (int i = 1; i <= n; i++) {
    if (maxx == a[i].second) c++;
  }
  if (c != 1) {
    cout << -1 << endl;
    return 0;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      double x = a[i].first - a[j].first;
      double y = a[i].second - a[j].second;
      dis[i][j] = sqrt(x * x + y * y);
    }
  }
  int st = n * 2 + 1;
  int En = n * 2 + 2;
  MCMF My = MCMF(st, En, n * 2 + 5);
  for (int i = 1; i <= n; i++) {
    My.addEdge(st, i, 2, 0);
  }
  for (int i = 1; i <= n; i++) {
    My.addEdge(n + i, En, 1, 0);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (i != j && a[j].second < a[i].second) {
        My.addEdge(i, j + n, 1, dis[i][j]);
      }
    }
  }
  pair<double, int> ans = My.minCostMaxFlow();
  if (ans.second != n - 1) {
    cout << -1;
  } else {
    printf("%.6f", ans.first);
  }
  return 0;
}