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 int read() {
  int k = 1, re = 0;
  char ch = getchar();
  while (ch > '9' || ch < '0') {
    if (ch == '-') k = -1;
    ch = getchar();
  }
  while (ch <= '9' && ch >= '0') {
    re = re * 10 + ch - 48;
    ch = getchar();
  }
  return re * k;
}
inline void write(int x) {
  if (x < 0) return putchar('-'), write(-x), void();
  if (x <= 9) return putchar(x + 48), void();
  return write(x / 10), write(x % 10), void();
}
int head[10005], cur[10005], tot = 1, dis[10005], cnt, s, t, n, k, ans;
double d[10005];
bool vis[10005];
struct ss {
  int node, nxt, w;
  double f;
} e[500005];
inline void add(int u, int v, int w, double f) {
  e[++tot].nxt = head[u];
  e[tot].node = v;
  e[tot].w = w;
  e[tot].f = f;
  head[u] = tot;
}
inline void _add(int u, int v, int w, double f) {
  add(u, v, w, f);
  add(v, u, 0, -f);
}
bool bfs() {
  for (register int i = 0; i <= cnt; i++) vis[i] = 0, d[i] = 1e9;
  queue<int> q;
  q.push(s);
  d[s] = 0;
  vis[s] = 1;
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    vis[x] = 0;
    for (register int i = head[x]; i; i = e[i].nxt) {
      if (!e[i].w) continue;
      int y = e[i].node;
      if (d[y] > d[x] + e[i].f + 1e-8) {
        d[y] = d[x] + e[i].f;
        if (!vis[y]) {
          vis[y] = 1;
          q.push(y);
        }
      }
    }
  }
  return d[t] + 1e-8 < 1e9;
}
double tans;
int fans;
int dinic(int x, int now) {
  if (!now || x == t) return now;
  vis[x] = 1;
  int ans = 0;
  for (register int i = cur[x]; i && now != ans; i = e[i].nxt) {
    int y = e[i].node;
    cur[x] = i;
    if (!vis[y] &&
        (d[y] < d[x] + e[i].f + 1e-8 && d[y] > d[x] + e[i].f - 1e-8) &&
        e[i].w) {
      int t = dinic(y, min(e[i].w, now - ans));
      e[i].w -= t;
      e[i ^ 1].w += t;
      ans += t;
      tans += t * e[i].f;
    }
  }
  vis[x] = 0;
  return ans;
}
struct st {
  int x, y;
  bool operator<(const st ot) const { return y < ot.y; }
} a[405];
signed main() {
  n = read();
  for (register int i = 1; i <= n; i++) {
    a[i].x = read();
    a[i].y = read();
  }
  sort(a + 1, a + n + 1);
  cnt = t = n + n + 1;
  for (register int i = 1; i <= n; i++) {
    _add(s, i + n, 2, 0);
    if (i < n) _add(i, t, 1, 0);
    for (register int j = 1; j < i; j++) {
      if (a[j].y != a[i].y)
        _add(i + n, j, 1,
             sqrt((a[i].x - a[j].x) * (a[i].x - a[j].x) +
                  (a[i].y - a[j].y) * (a[i].y - a[j].y)));
    }
  }
  while (bfs()) {
    int now;
    do {
      for (register int i = 0; i <= cnt; i++) cur[i] = head[i];
      now = dinic(s, 0x3f3f3f3f);
      fans += now;
    } while (now);
  }
  if (fans != n - 1)
    write(-1);
  else
    cout << fixed << setprecision(8) << tans << endl;
}