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 T>
inline void read(T &num) {
  num = 0;
  bool w = 1;
  char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') w = 0;
    c = getchar();
  }
  while (isdigit(c)) {
    num = num * 10 + c - '0';
    ;
    c = getchar();
  }
  num = w ? num : -num;
}
const int N = 1010, M = 2e5 + 10;
const double inf = 1e9;
int n, m, s, t, to[M], nxt[M], H[N], tot = 1, edg[M], pre[N], pos[N], flow[N],
                                     Maxflow, in[N];
double cost[M], d[N], Mincost;
struct P {
  int x, y;
} p[N];
inline bool cmp(P a, P b) { return a.y > b.y; }
inline void add(int u, int v, int w, double c) {
  to[++tot] = v, edg[tot] = w, cost[tot] = c, nxt[tot] = H[u], H[u] = tot;
  to[++tot] = u, edg[tot] = 0, cost[tot] = -c, nxt[tot] = H[v], H[v] = tot;
}
inline double dis(int a, int b) {
  int x = p[a].x - p[b].x, y = p[a].y - p[b].y;
  return sqrt(x * x + y * y);
}
inline bool spfa() {
  for (int i = s; i <= t; i++) d[i] = inf, pre[i] = 0;
  queue<int> q;
  d[s] = 0, flow[s] = inf;
  q.push(s);
  in[s] = 1;
  while (q.size()) {
    int x = q.front();
    q.pop();
    in[x] = 0;
    for (int i = H[x]; i; i = nxt[i]) {
      if (!edg[i]) continue;
      int y = to[i];
      double z = cost[i];
      if (d[y] <= d[x] + z) continue;
      d[y] = d[x] + z;
      pre[y] = i;
      flow[y] = min(flow[x], edg[i]);
      if (in[y]) continue;
      in[y] = 1, q.push(y);
    }
  }
  if (pre[t] && d[t] && flow[t]) return 1;
  return 0;
}
inline void up() {
  int x = t, i;
  while (x != s) {
    i = pre[x];
    edg[i] -= flow[t];
    edg[i ^ 1] += flow[t];
    x = to[i ^ 1];
  }
  Mincost += d[t] * flow[t];
  Maxflow += flow[t];
}
signed main() {
  read(n);
  for (int i = 1; i <= n; i++) read(p[i].x), read(p[i].y);
  sort(p + 1, p + 1 + n, cmp);
  s = 0, t = n << 1 | 1;
  for (int i = 1; i <= n; i++)
    add(s, i, 2, 0), add(i + n, t, 1, 0), pos[i] = tot ^ 1;
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (p[i].y == p[j].y) continue;
      add(i, j + n, 1, dis(i, j));
    }
  }
  while (spfa()) up();
  int cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (edg[pos[i]]) cnt++;
  }
  if (cnt > 1) return puts("-1"), 0;
  printf("%.15lf\n", Mincost);
  return 0;
}