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;
int n, m, sumf, x, y, k, t, des, det, nume;
int vis[1111], q[1111 * 1111], pre[1111], fro[1111];
long double ans, dist[1111], oo;
struct node {
  int next, y, f;
  long double c;
} z[1111 * 1111 + 1111];
struct point {
  int x, y;
} a[1111];
int sqr(int x) { return x * x; }
long double calc(int x, int y) {
  return sqrt(sqr(a[x].x - a[y].x) + sqr(a[x].y - a[y].y));
}
void fill(long double x[], long double y) {
  for (int i = 0; i <= det; i++) x[i] = y;
}
bool check(long double x) { return (abs(x) < 1e-7); }
bool spfa() {
  fill(dist, oo);
  dist[des] = 0;
  vis[des] = 1;
  q[1] = des;
  int ff = 1;
  int rr = 1;
  while (ff <= rr) {
    int k = q[ff++];
    vis[k] = 0;
    for (int p = z[k].next; p; p = z[p].next) {
      int t = z[p].y;
      if (z[p].f && dist[k] + z[p].c < dist[t]) {
        dist[t] = dist[k] + z[p].c;
        if (!vis[t]) {
          q[++rr] = t;
          vis[t] = rr;
        }
        if (dist[t] < dist[q[ff]]) {
          vis[q[ff]] = vis[t];
          swap(q[ff], q[vis[t]]);
          vis[t] = ff;
        }
        fro[t] = k;
        pre[t] = p;
      }
    }
  }
  return !check(dist[det] - oo);
}
void aug() {
  int flow = 1 << 30;
  for (int k = det; k != des; k = fro[k]) flow = min(flow, z[pre[k]].f);
  sumf += flow;
  for (int k = det; k != des; k = fro[k]) {
    ans += flow * z[pre[k]].c;
    z[pre[k]].f -= flow;
    z[pre[k] ^ 1].f += flow;
  }
}
void link(int x, int y, int flow, long double cost) {
  nume++;
  z[nume].next = z[x].next;
  z[x].next = nume;
  z[nume].y = y;
  z[nume].f = flow;
  z[nume].c = cost;
  nume++;
  z[nume].next = z[y].next;
  z[y].next = nume;
  z[nume].y = x;
  z[nume].f = 0;
  z[nume].c = -cost;
}
int main() {
  scanf("%d", &n);
  oo = 1ll << 60;
  memset(vis, 0, sizeof(vis));
  memset(z, 0, sizeof(z));
  for (int i = 0; i < n; i++) scanf("%d%d", &a[i].x, &a[i].y);
  des = n * 2;
  det = des + 1;
  sumf = 0;
  ans = 0;
  nume = det + 1;
  if (!(nume & 1)) nume++;
  for (int i = 0; i < n; i++) {
    link(des, i, 2, 0);
    link(n + i, det, 1, 0);
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (a[j].y < a[i].y) link(i, n + j, 1, calc(i, j));
  while (spfa()) aug();
  if (sumf == n - 1)
    printf("%.10f\n", (double)ans);
  else
    printf("-1\n");
  return 0;
}