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;
inline void read(int &x) {
  x = 0;
  char ch = getchar(), flag = 0;
  while ((ch > '9' || ch < '0') && ch != '-') ch = getchar();
  if (ch == '-') flag = 1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  if (flag) x = -x;
}
inline void read(int &x, int &y) { read(x), read(y); }
inline void read(int &x, int &y, int &z) { read(x), read(y), read(z); }
struct node {
  int to, next, flow;
  double cost;
} p[350005];
const int mod = 1000;
const double eps = 1e-9, inf = 100000000;
int head[1005], tot, n, k, S, T, from[1005], use[1005], x[1005], y[1005];
double d[1005];
bool vis[1005];
inline void add(int x, int y, int f, double w) {
  p[tot].to = y;
  p[tot].next = head[x];
  p[tot].flow = f;
  p[tot].cost = w;
  head[x] = tot++;
  p[tot].to = x;
  p[tot].next = head[y];
  p[tot].flow = 0;
  p[tot].cost = -w;
  head[y] = tot++;
}
inline int inc(int &x) {
  x++;
  if (x >= mod) x -= mod;
  return x;
}
queue<int> q;
inline bool spfa() {
  int h = 0, t = 1;
  memset(vis, 0, sizeof(vis));
  for (int i = S; i <= T; i++) d[i] = inf;
  vis[S] = 1;
  d[S] = 0.0;
  q.push(S);
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    vis[x] = 0;
    for (int i = head[x]; ~i; i = p[i].next) {
      if (!p[i].flow) continue;
      int y = p[i].to;
      double w = p[i].cost;
      if (d[y] > d[x] + w) {
        d[y] = d[x] + w;
        from[y] = x;
        use[y] = i;
        if (!vis[y]) q.push(y), vis[y] = 1;
      }
    }
  }
  return d[T] < inf;
}
inline double extend() {
  int x = T;
  double ans = 0.0;
  while (S != x) {
    p[use[x]].flow--;
    p[use[x] ^ 1].flow++;
    ans += p[use[x]].cost;
    x = from[x];
  }
  return ans;
}
inline double dis(int a, int b) {
  return sqrt((double)(((double)(x[a] - x[b])) * ((double)(x[a] - x[b])) +
                       ((double)(y[a] - y[b])) * ((double)(y[a] - y[b]))));
}
int main() {
  memset(head, -1, sizeof(head));
  scanf("%d", &n);
  S = 0, T = n * 2 + 1;
  for (int i = 1; i <= n; i++)
    add(S, i, 2, 0), add(i + n, T, 1, 0), scanf("%d%d", &x[i], &y[i]);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) {
      if (y[i] > y[j]) add(i, j + n, 1, dis(i, j));
    }
  int ans1;
  double ans2;
  ans1 = 0;
  ans2 = 0.0;
  while (spfa()) ans2 += extend(), ans1++;
  if (ans1 < n - 1)
    puts("-1");
  else
    printf("%.15f\n", ans2);
  return 0;
}