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;
template <class T>
inline void read(T& x) {
  bool fu = 0;
  char c;
  for (c = getchar(); c <= 32; c = getchar())
    ;
  if (c == '-') fu = 1, c = getchar();
  for (x = 0; c > 32; c = getchar()) x = x * 10 + c - '0';
  if (fu) x = -x;
};
char getc() {
  char c;
  for (c = getchar(); c <= 32; c = getchar())
    ;
  return c;
}
int i, j, k, l, p;
int n, X[510], Y[510];
const int V = 1100;
const int E = 1000010;
const int inf = 2000000000;
int edge, S, T, N, fir[V], last[V], e[E], b[E], c[E], totflow;
long double w[E], dis[V], totcost, de[V];
int cur[V], vh[V], h[V];
int q[E * 10];
bool v[V], o[V];
bool can;
void clear() {
  edge = 0;
  memset(b, -1, sizeof(b));
  memset(fir, -1, sizeof(fir));
}
void add2(int x, int y, int z, long double q) {
  e[edge] = y;
  c[edge] = z;
  w[edge] = q;
  if (fir[x] == -1)
    fir[x] = edge;
  else
    b[last[x]] = edge;
  last[x] = edge++;
}
void add(int x, int y, int z, long double q) {
  add2(x, y, z, q);
  add2(y, x, 0, -q);
}
void spfa() {
  int i, j, k, u;
  for (i = 1; i <= N; i++) dis[i] = inf;
  memset(v, 0, sizeof(v));
  q[1] = S;
  dis[S] = 0;
  v[S] = 1;
  for (i = j = 1; u = q[i], i <= j; v[u] = 0, i++)
    for (k = fir[u]; k >= 0; k = b[k])
      if (c[k])
        if (dis[u] + w[k] < dis[e[k]]) {
          dis[e[k]] = dis[u] + w[k];
          if (!v[e[k]]) {
            v[e[k]] = 1;
            q[++j] = e[k];
          }
        }
}
int zkw(int i, int flow) {
  int d, r = flow;
  long double l;
  if (i == T) {
    if (dis[i] < 0) totcost += dis[i] * flow;
    return flow;
  }
  v[i] = o[i] = 1;
  for (int& k = cur[i]; k >= 0; k = b[k])
    if (c[k]) {
      l = dis[i] + w[k] - dis[e[k]];
      de[e[k]] = min(de[e[k]], l);
      if (abs(l) <= 1e-8 && !o[e[k]]) {
        d = zkw(e[k], min(c[k], r));
        c[k] -= d;
        c[k ^ 1] += d;
        r -= d;
        if (r == 0) break;
      }
    }
  o[i] = 0;
  return flow - r;
}
void solve() {
  spfa();
  memset(v, 0, sizeof(v));
  memset(o, 0, sizeof(o));
  int i;
  long double tmp;
  totcost = totflow = 0;
  while (1) {
    for (i = 1; i <= N; i++) de[i] = inf, v[i] = 0, cur[i] = fir[i];
    totflow += zkw(S, inf);
    if (can) break;
    tmp = inf;
    for (i = 1; i <= N; i++)
      if (!v[i]) tmp = min(tmp, de[i]);
    if (tmp == inf) break;
    for (i = 1; i <= N; i++)
      if (!v[i]) dis[i] += tmp;
  }
}
int main() {
  read(n);
  for (i = 1; i <= n; i++) read(X[i]), read(Y[i]);
  S = 2 * n + 1;
  N = T = 2 * n + 2;
  clear();
  for (i = 1; i <= n; i++) add(S, i, 2, 0), add(n + i, T, 1, -1e9);
  for (i = 1; i <= n; i++)
    for (j = 1; j <= n; j++)
      if (i != j)
        if (Y[i] > Y[j])
          add(i, n + j, 1,
              sqrt(((X[i] - X[j]) * (X[i] - X[j])) +
                   ((Y[i] - Y[j]) * (Y[i] - Y[j]))));
  solve();
  if (totflow != n - 1)
    printf("-1\n");
  else
    cout << fixed << setprecision(10) << totcost + (n - 1) * 1e9 << endl;
  scanf("\n");
  return 0;
}