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>
int a, b, c, d, e, g, h, i, j;
double po[505][3], w;
struct node {
  int u, v;
  int w;
  double va;
  int next;
};
struct node f[1000005];
int end[1005];
int an;
double an1;
int qq[1005];
double F[1005];
int que[10005];
int v[1005];
void set(int u, int v, int w, double va) {
  f[++e].u = u;
  f[e].v = v;
  f[e].w = w;
  f[e].va = va;
  f[e].next = end[u];
  end[u] = e;
}
int Min(int x, int y) {
  if (x < y) return x;
  return y;
}
int Find(int l, int r) {
  int ii, jj, kk;
  int ll, rr;
  memset(v, 0, sizeof(v));
  for (ii = l; ii <= r; ii++) F[ii] = (double)(1 << 30);
  F[l] = 0.0;
  que[1] = l;
  v[l] = 1;
  ll = 0;
  rr = 1;
  while (ll < rr) {
    ll++;
    jj = end[que[ll]];
    while (jj) {
      if (f[jj].w > 0 && F[que[ll]] + f[jj].va < F[f[jj].v]) {
        F[f[jj].v] = F[que[ll]] + f[jj].va;
        qq[f[jj].v] = jj;
        if (v[f[jj].v] == 0) {
          que[++rr] = f[jj].v;
          v[f[jj].v] = 1;
        }
      }
      jj = f[jj].next;
    }
    v[que[ll]] = 0;
  }
  if (F[r] >= (double)(1 << 30) - 1e-5) return 0;
  d = 1 << 30;
  for (ii = r; ii != l; ii = f[qq[ii]].u) d = Min(d, f[qq[ii]].w);
  w = F[r];
  if (F[r] != (double)(1 << 30)) return 1;
  return 0;
}
int Minus(int x, int y) {
  int ii;
  f[x].w -= y;
  if (x & 1)
    ii = x + 1;
  else
    ii = x - 1;
  f[ii].w += y;
}
void L(int l, int r) {
  int ii, jj, kk;
  while (Find(l, r)) {
    an += d;
    an1 += (double)d * w;
    for (ii = r; ii != l; ii = f[qq[ii]].u) Minus(qq[ii], d);
  }
}
double JL(int x, int y) {
  return sqrt((po[x][0] - po[y][0]) * (po[x][0] - po[y][0]) +
              (po[x][1] - po[y][1]) * (po[x][1] - po[y][1]));
}
int main() {
  scanf("%d", &a);
  for (i = 1; i <= a; i++) scanf("%lf%lf", &po[i][0], &po[i][1]);
  for (i = 1; i <= a; i++)
    for (j = 1; j <= a; j++)
      if (i != j && po[i][1] > po[j][1]) {
        w = JL(i, j);
        set(i + 1, a + j + 1, 1, w);
        set(a + j + 1, i + 1, 0, -w);
      }
  for (i = 1; i <= a; i++) {
    set(1, 1 + i, 2, 0.0);
    set(1 + i, 1, 0, 0.0);
  }
  for (i = 1; i <= a; i++) {
    set(1 + i + a, 1 + a + a + 1, 1, 0.0);
    set(1 + a + a + 1, 1 + i + a, 0, 0.0);
  }
  L(1, 1 + a + a + 1);
  if (an == a - 1)
    printf("%.20lf\n", an1);
  else
    printf("-1\n");
  return 0;
}