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;
inline void read(int &x) {
  x = 0;
  char ch;
  bool flag = false;
  while (ch = getchar(), ch < '!')
    ;
  if (ch == '-') ch = getchar(), flag = true;
  while (x = 10 * x + ch - '0', ch = getchar(), ch > '!')
    ;
  if (flag) x = -x;
}
inline int cat_max(const int &a, const int &b) { return a > b ? a : b; }
inline int cat_min(const int &a, const int &b) { return a < b ? a : b; }
const int maxn = 410;
const int maxnode = 1024;
const int maxedge = 210010;
const int inf = 0x3f3f3f3f;
const double eps = 1e-9;
struct Edge {
  int to, next, cap;
  double cost;
} G[maxedge << 1];
int head[maxnode], cnt = 1;
void add(int u, int v, int cap, double cost) {
  G[++cnt].to = v;
  G[cnt].next = head[u];
  G[cnt].cap = cap;
  G[cnt].cost = cost;
  head[u] = cnt;
}
inline void insert(int u, int v, int cap, double cost) {
  add(u, v, cap, cost);
  add(v, u, 0, -cost);
}
double dis[maxnode], ans;
int flow[maxnode], q[maxnode + 10], p[maxnode];
int l, r, S, T, num;
bool inq[maxnode];
bool spfa() {
  for (int i = 0; i <= T + 1; ++i) dis[i] = 1e10;
  dis[S] = 0;
  l = 0;
  r = -1;
  q[++r] = S;
  inq[S] = true;
  flow[S] = inf;
  while (l <= r) {
    int u = q[l % maxnode];
    ++l;
    inq[u] = false;
    for (int i = head[u]; i; i = G[i].next) {
      if (dis[G[i].to] > dis[u] + G[i].cost && G[i].cap) {
        dis[G[i].to] = dis[u] + G[i].cost;
        flow[G[i].to] = cat_min(flow[u], G[i].cap);
        p[G[i].to] = i;
        if (!inq[G[i].to]) {
          q[++r % maxnode] = G[i].to;
          inq[G[i].to] = true;
        }
      }
    }
  }
  if (fabs(dis[T] - dis[T + 1]) < eps) return false;
  ans += dis[T] * flow[T];
  num += flow[T];
  for (int u = T; u != S; u = G[p[u] ^ 1].to) {
    G[p[u]].cap -= flow[T], G[p[u] ^ 1].cap += flow[T];
  }
  return true;
}
struct Node {
  int x, y;
  double friend operator^(const Node &a, const Node &b) {
    return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
  }
} a[maxn];
int main() {
  int n;
  read(n);
  S = (n << 1) + 2;
  T = S + 1;
  for (int i = 1; i <= n; ++i) {
    read(a[i].x);
    read(a[i].y);
    insert(i << 1, T, 1, 0);
    insert(S, i << 1 | 1, 2, 0);
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      if (i == j) continue;
      if (a[i].y > a[j].y) {
        insert(i << 1 | 1, j << 1, 1, a[i] ^ a[j]);
      }
    }
  }
  while (spfa())
    ;
  if (num != n - 1)
    puts("-1");
  else
    printf("%.15lf\n", ans);
  getchar();
  getchar();
  return 0;
}