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>
inline long long read() {
  long long x = 0;
  char ch = getchar(), w = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * w;
}
void write(long long x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
inline void writeln(long long x) {
  write(x);
  puts("");
}
using namespace std;
const int N = 410;
int n;
struct T {
  int x, y;
} a[N];
const int M = N * N * 6;
struct Edge {
  int u, v, nxt, f;
  double w;
} e[M * 2];
int head[N * 2], en = 1;
void addl(int x, int y, double z, int f) {
  e[++en].u = x, e[en].v = y, e[en].nxt = head[x], head[x] = en, e[en].f = f,
  e[en].w = z;
  e[++en].u = y, e[en].v = x, e[en].nxt = head[y], head[y] = en, e[en].f = 0,
  e[en].w = -z;
}
int s, t;
double d[N * 2];
queue<int> q;
bool inq[N * 2];
int inc[N << 1];
int pre[N << 1];
const int inf = 1e9;
bool spfa() {
  for (int i = 1; i <= t; ++i) d[i] = 1e111, inq[i] = 0;
  d[s] = 0;
  inc[s] = inf;
  q.push(s);
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    inq[x] = 0;
    for (int i = head[x]; i; i = e[i].nxt)
      if (e[i].f && d[e[i].v] > d[x] + e[i].w) {
        inc[e[i].v] = min(inc[x], e[i].f);
        d[e[i].v] = d[x] + e[i].w;
        pre[e[i].v] = i;
        if (!inq[e[i].v]) {
          inq[e[i].v] = 1;
          q.push(e[i].v);
        }
      }
  }
  return d[t] < 1e111;
}
int ans1;
double ans2;
void KM() {
  ans1 += inc[t];
  ans2 += inc[t] * d[t];
  int x = t;
  while (x != s) {
    e[pre[x]].f -= inc[t];
    e[pre[x] ^ 1].f += inc[t];
    x = e[pre[x]].u;
  }
}
int main() {
  n = read();
  for (int i = 1; i <= n; ++i) a[i].x = read(), a[i].y = read();
  int p = 1;
  for (int i = 2; i <= n; ++i)
    if (a[i].y > a[p].y) p = i;
  s = n * 2 + 1;
  t = n * 2 + 2;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      if (a[i].y > a[j].y) {
        addl(i, j + n,
             sqrt(((a[i].y - a[j].y) * (a[i].y - a[j].y)) +
                  ((a[i].x - a[j].x) * (a[i].x - a[j].x))),
             1);
      }
  for (int i = 1; i <= n; ++i) {
    addl(i + n, t, 0, 1);
    addl(s, i, 0, 2);
  }
  while (spfa()) {
    KM();
  }
  if (ans1 != n - 1) {
    puts("-1");
    return 0;
  }
  printf("%.8lf\n", ans2);
  return 0;
}