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;
static const int MAXN = 450;
static const int POICNT = 1e5, EDGECNT = 3e6;
int SHd[POICNT], STo[EDGECNT], SNxt[EDGECNT], SFlow[EDGECNT], SCnt;
double SDis[EDGECNT];
inline void ae(int f, int t, int fl, double d) {
  SNxt[++SCnt] = SHd[f];
  STo[SCnt] = t, SFlow[SCnt] = fl, SDis[SCnt] = d, SHd[f] = SCnt;
}
inline void aef(int f, int t, int fl, double d) {
  ae(f, t, fl, d);
  ae(t, f, 0, -d);
}
double Dis[POICNT];
int Pre[POICNT], Minn[POICNT], Vis[POICNT];
inline int ri() {
  char c = getchar();
  int r = 0, f = 1;
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-') c = getchar(), f = -1;
  while (isdigit(c)) {
    r = r * 10 + c - '0';
    c = getchar();
  }
  return r * f;
}
std::queue<int> Q;
int SPFA() {
  Q.push(0);
  memset(Dis, 0x7f, sizeof(Dis));
  Dis[0] = 0;
  memset(Minn, 0, sizeof(Minn));
  memset(Vis, 0, sizeof(Vis));
  Minn[0] = 0x6f6f6f6f;
  while (!Q.empty()) {
    int u = Q.front();
    Vis[u] = 1;
    Q.pop();
    for (int i = SHd[u]; i != -1; i = SNxt[i])
      if (SFlow[i]) {
        int v = STo[i];
        if (Dis[u] + SDis[i] < Dis[v]) {
          Dis[v] = Dis[u] + SDis[i];
          Q.push(v);
          Pre[v] = i;
          Minn[v] = std::min(Minn[u], SFlow[i]);
        }
      }
  }
  return Vis[(POICNT - 1)];
}
void Solve() {
  int AnsFlow = 0;
  double AnsCost = 0;
  while (SPFA()) {
    AnsCost += Dis[(POICNT - 1)] * Minn[(POICNT - 1)];
    AnsFlow += Minn[(POICNT - 1)];
    int Now = (POICNT - 1);
    do {
      SFlow[Pre[Now]] -= Minn[(POICNT - 1)];
      SFlow[(((Pre[Now] - 1) ^ 1) + 1)] += Minn[(POICNT - 1)];
      Now = STo[(((Pre[Now] - 1) ^ 1) + 1)];
    } while (Now != 0);
  }
  if (AnsFlow == N - 1) {
    printf("%.7lf\n", AnsCost);
  } else
    cout << -1 << endl;
}
int X[MAXN], Y[MAXN];
double pow2(int x) { return ((double)x) * x; }
double get_dis(int i, int j) {
  return sqrt(pow2(X[i] - X[j]) + pow2(Y[i] - Y[j]));
}
int main() {
  memset(SHd, -1, sizeof(SHd));
  N = ri();
  for (int i = 1; i <= N; i++) {
    aef(0, i << 1, 2, 0);
    cin >> X[i] >> Y[i];
    aef(i << 1 | 1, (POICNT - 1), 1, 0);
  }
  for (int i = 1; i <= N; i++) {
    for (int j = 1; j <= N; j++)
      if (Y[i] > Y[j]) {
        aef(i << 1, j << 1 | 1, 1, get_dis(i, j));
      }
  }
  Solve();
  return 0;
}