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 maxn = 400 * 2 + 5, M = (1 << 10) - 1, maxm = maxn * maxn;
const long long inf = 1e18 + 10, de = 1e7;
int n, m, from[maxm], to[maxm], W[maxm];
long long cost[maxm];
vector<int> G[maxn];
struct FLOW {
  int s, t;
  int n, Q[M + 1], par[maxn];
  long long H[maxn];
  bool mark[maxn];
  bool spfa() {
    for (int a = 0; a < n; a++) {
      H[a] = inf;
    }
    H[s] = 0;
    int l = 0, r = 0;
    Q[r] = s;
    r = (r + 1) & M;
    while (l != r) {
      int a = Q[l];
      l = (l + 1) & M;
      mark[a] = 0;
      for (int id : G[a]) {
        int b = to[id];
        if (W[id] > 0 && H[a] + cost[id] < H[b]) {
          H[b] = H[a] + cost[id];
          par[b] = id;
          if (!mark[b]) {
            mark[b] = 1;
            Q[r] = b;
            r = (r + 1) & M;
          }
        }
      }
    }
    return H[t] < inf;
  }
  long long solve() {
    for (int a = 0; a < n; a++) {
      random_shuffle(G[a].begin(), G[a].end());
    }
    long long ans = 0;
    int cnt = 0;
    while (spfa()) {
      int b = t;
      cnt++;
      ans += H[t];
      while (b != s) {
        int id = par[b];
        W[id]--;
        W[id ^ 1]++;
        b = from[id];
      }
    }
    if (cnt < ::n - 1) {
      printf("-1\n");
      exit(0);
    }
    return ans;
  }
} flow;
void add_edge(int a, int b, long long c, int w) {
  from[m] = a;
  to[m] = b;
  W[m] = w;
  cost[m] = +c;
  G[a].push_back(m++);
  from[m] = b;
  to[m] = a;
  W[m] = 0;
  cost[m] = -c;
  G[b].push_back(m++);
}
pair<int, int> p[maxn];
long long dis(int i, int j) {
  return sqrt((p[i].first - p[j].first) * (p[i].first - p[j].first) +
              (p[i].second - p[j].second) * (p[i].second - p[j].second)) *
         de;
}
int32_t main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &p[i].first, &p[i].second);
  }
  flow.s = 2 * n;
  flow.t = 2 * n + 1;
  flow.n = 2 * n + 2;
  sort(p, p + n,
       [](pair<int, int> a, pair<int, int> b) { return b.second < a.second; });
  if (n > 1 && p[0].second == p[1].second) {
    printf("-1\n");
    return 0;
  }
  for (int a = 1; a < n; a++) {
    add_edge(flow.s, a, 0, 1);
  }
  for (int a = 0; a < n; a++) {
    add_edge(a + n, flow.t, 0, 1);
    add_edge(a + n, flow.t, 0, 1);
  }
  for (int a = 0; a < n; a++) {
    for (int b = a + 1; b < n; b++) {
      if (p[b].second < p[a].second) {
        add_edge(b, a + n, dis(a, b), 1);
      }
    }
  }
  printf("%.7lf\n", (flow.solve()) / double(de));
}