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 <typename T1, typename T2>
void chkmin(T1 &x, T2 y) {
  if (x > y) x = y;
}
template <typename T1, typename T2>
void chkmax(T1 &x, T2 y) {
  if (x < y) x = y;
}
template <typename T>
void read(T &x) {
  x = 0;
  char c = getchar();
  T neg = 1;
  while (!isdigit(c)) {
    if (c == '-') neg = -1;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
  x *= neg;
}
const int MAXN = 400;
const int MAXV = 802;
const int MAXE = 3e5;
const int INF = 0x3f3f3f3f;
int n, x[MAXN + 5], y[MAXN + 5], S = 801, T = 802;
int hd[MAXV + 5], to[MAXE + 5], nxt[MAXE + 5], cap[MAXE + 5], ec = 1;
double cst[MAXE + 5];
double dis(int x1, int y1, int x2, int y2) {
  return sqrt(1ll * (x2 - x1) * (x2 - x1) + 1ll * (y2 - y1) * (y2 - y1));
}
void adde(int u, int v, int f, double c) {
  to[++ec] = v;
  cap[ec] = f;
  cst[ec] = c;
  nxt[ec] = hd[u];
  hd[u] = ec;
  to[++ec] = u;
  cap[ec] = 0;
  cst[ec] = -c;
  nxt[ec] = hd[v];
  hd[v] = ec;
}
double dist[MAXV + 5];
int flw[MAXV + 5], pre[MAXV + 5], lste[MAXV + 5];
bool inq[MAXV + 5];
bool getdis() {
  fill(dist, dist + MAXV + 1, INF);
  memset(flw, 0, sizeof(flw));
  dist[S] = 0;
  flw[S] = INF;
  queue<int> q;
  q.push(S);
  inq[S] = 1;
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    inq[x] = 0;
    for (int e = hd[x]; e; e = nxt[e]) {
      int y = to[e], z = cap[e];
      double w = cst[e];
      if (dist[y] > dist[x] + w && z) {
        dist[y] = dist[x] + w;
        flw[y] = min(flw[x], z);
        pre[y] = x;
        lste[y] = e;
        if (!inq[y]) {
          inq[y] = 1;
          q.push(y);
        }
      }
    }
  }
  return dist[T] < INF;
}
pair<int, double> mcmf() {
  int mxfl = 0;
  double mncst = 0;
  while (getdis()) {
    mxfl += flw[T];
    mncst += flw[T] * dist[T];
    for (int i = T; i != S; i = pre[i]) {
      cap[lste[i]] -= flw[T];
      cap[lste[i] ^ 1] += flw[T];
    }
  }
  return make_pair(mxfl, mncst);
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &x[i], &y[i]);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (y[i] < y[j]) {
        adde(j + n, i, 1, dis(x[i], y[i], x[j], y[j]));
      }
  for (int i = 1; i <= n; i++) adde(S, i + n, 2, 0);
  for (int i = 1; i <= n; i++) adde(i, T, 1, 0);
  pair<int, double> ans = mcmf();
  if (ans.first != n - 1)
    puts("-1");
  else
    printf("%.10lf\n", ans.second);
  return 0;
}