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 double eps = 1e-8;
class Solver {
  struct Edge {
    int b, w;
    double c, c0;
    int revi;
    Edge(int b, int w, double c, int revi)
        : b(b), w(w), c(c), c0(c), revi(revi) {}
  };
  int n;
  vector<vector<Edge> > es;

 public:
  Solver(int n) : n(n), es(n) {}
  void adde(int a, int b, int maxf, double c) {
    int aid = ((int)(es[a]).size()), bid = ((int)(es[b]).size());
    es[a].push_back(Edge(b, maxf, c, bid));
    es[b].push_back(Edge(a, 0, -c, aid));
  }
  pair<int, double> solve() {
    int curf = 0;
    double curc = 0;
    for (;;) {
      vector<double> d(n, 1e100);
      vector<int> fr(n, -1), fre(n, -1);
      d[0] = 0;
      vector<bool> red(n, false);
      for (;;) {
        double minv = 1e100;
        int mini = -1;
        for (int i = 0; i < n; i++)
          if (!red[i] && minv - eps > d[i]) {
            minv = d[i];
            mini = i;
          }
        if (mini < 0) break;
        red[mini] = true;
        for (int i2 = 0; i2 < ((int)(es[mini]).size()); i2++)
          if (es[mini][i2].w > 0) {
            int b = es[mini][i2].b;
            double nd = minv + es[mini][i2].c;
            if (d[b] <= nd + eps) continue;
            d[b] = nd;
            fr[b] = mini;
            fre[b] = i2;
          }
      }
      if (!red[n - 1]) break;
      curf++;
      for (int v = n - 1; v > 0;) {
        int x = fr[v], xi = fre[v];
        assert(es[x][xi].b == v);
        curc += es[x][xi].c0;
        assert(es[x][xi].w > 0);
        es[x][xi].w--;
        es[v][es[x][xi].revi].w++;
        v = x;
      }
      for (int i = 0; i < ((int)(es).size()); i++)
        for (int i2 = 0; i2 < ((int)(es[i]).size()); i2++) {
          es[i][i2].c += d[i] - d[es[i][i2].b];
          if (es[i][i2].w > 0) assert(es[i][i2].c >= -eps);
        }
    }
    return make_pair(curf, curc);
  }
};
struct pt {
  int x, y;
  pt() : x(0), y(0) {}
  pt(int x, int y) : x(x), y(y) {}
  pt operator-(const pt &p2) const { return pt(x - p2.x, y - p2.y); }
  double dist() const { return sqrt(x * x + y * y); }
};
int main() {
  int n;
  while (scanf("%d", &n) >= 1) {
    vector<pt> pts(n);
    for (int i = 0; i < n; i++) scanf("%d%d", &pts[i].x, &pts[i].y);
    Solver s(2 * n + 2);
    for (int i = 0; i < n; i++) {
      s.adde(0, 1 + i, 1, 0);
      for (int j = 0; j < n; j++)
        if (pts[i].y < pts[j].y)
          s.adde(1 + i, 1 + n + j, 1, (pts[i] - pts[j]).dist());
      s.adde(1 + n + i, 1 + n + n, 2, 0);
    }
    pair<int, double> res = s.solve();
    if (res.first != n - 1)
      printf("-1\n");
    else
      printf("%.18lf\n", res.second);
  }
  return 0;
}