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;
void bug() { cout << " " << endl; }
template <class T>
void bug(T a) {
  cout << a << "  ";
}
template <class T>
void bug(T* a, int n) {
  for (int i = 0; i < (n); i++) bug(a[i]);
}
struct edge {
  int u, v, next, c;
  double dis;
};
const int maxm = 2100000, maxn = 1100;
double oo = 1e200;
struct Graph {
  edge e[maxm];
  int size, n, S, T, Flow, g[maxn];
  double Cost;
  Graph() {
    size = 1;
    Cost = 0;
  }
  inline void add(int a, int b, int c, double d) {
    e[++size] = (edge){a, b, g[a], c, d};
    g[a] = size;
    e[++size] = (edge){b, a, g[b], 0, -d};
    g[b] = size;
  }
  int q[1000000], tail, head, in[maxn];
  double d[maxn];
  int fr[maxn];
  int spfa() {
    head = tail = 0;
    q[tail++] = S;
    for (int i = 0; i <= n; i++) d[i] = oo;
    d[S] = 0;
    while (head < tail) {
      int m = q[head++];
      in[m] = 0;
      for (int p = g[m]; p; p = e[p].next)
        if (e[p].c > 0 && d[e[p].v] > d[m] + e[p].dis) {
          d[e[p].v] = d[m] + e[p].dis;
          fr[e[p].v] = p;
          if (!in[e[p].v]) {
            q[tail++] = e[p].v;
            in[e[p].v] = 1;
          }
        }
    }
    return d[T] < oo;
  }
  void aug() {
    int flow = 100000000;
    for (int u = T; u != S; u = e[fr[u]].u) flow = min(flow, e[fr[u]].c);
    Flow += flow;
    Cost += flow * d[T];
    for (int u = T; u != S; u = e[fr[u]].u) {
      e[fr[u]].c -= flow;
      e[fr[u] ^ 1].c += flow;
    }
  }
  void CostFlow() {
    while (spfa()) aug();
  }
} G;
int n;
pair<int, int> p[1111];
int in[1111], out[1111];
double dist(pair<int, int> a, pair<int, int> b) {
  long long x = a.first - b.first, y = a.second - b.second;
  return sqrt(x * x + y * y);
}
int main() {
  cin >> n;
  for (int i = 0; i < (n); i++) cin >> p[i].second >> p[i].first;
  sort(p, p + n);
  reverse(p, p + n);
  if (p[0].first == p[1].first) {
    cout << -1 << endl;
    return 0;
  }
  G.n = 2 * n + 2;
  G.S = 2 * n + 1;
  G.T = 2 * n + 2;
  for (int i = 0; i < (n); i++) out[i] = 1 + i;
  for (int i = 0; i < (n); i++) in[i] = n + 1 + i;
  for (int i = 0; i < (n); i++) G.add(G.S, out[i], 2, 0);
  for (int i = 0; i < (n); i++)
    if (i > 0) G.add(in[i], G.T, 1, 0);
  for (int i = 0; i < (n); i++)
    for (int j = 0; j < (n); j++)
      if (p[i].first > p[j].first) G.add(out[i], in[j], 1, dist(p[i], p[j]));
  G.CostFlow();
  if (G.Flow < n - 1) {
    cout << "-1" << endl;
    return 0;
  } else {
    cout << fixed << setprecision(16);
    cout << G.Cost << endl;
  }
  return 0;
}