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>
namespace IO {
char buf[1000000], *p1, *p2;
inline char getc() {
  if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
  return p1 == p2 ? EOF : *(p1++);
}
template <typename tp>
inline void r(tp &n) {
  n = 0;
  char c = getc();
  int f = 1;
  while (!isdigit(c) && c != '-') c = getc();
  if (c == '-') f = -1, c = getc();
  while (isdigit(c)) n = n * 10 + c - 48, c = getc();
  n *= f;
}
template <typename tp>
inline void w(tp n) {
  if (n / 10) w(n / 10);
  putchar(n % 10 + 48);
}
};  // namespace IO
using namespace IO;
const int N = 1e3, M = 2e5, INF = 1e9;
using namespace std;
struct Node {
  double x, y;
} p[N];
int n, S, T, ans, num = 1;
int inq[N], pre[N], incf[N];
int head[N], nt[M << 1], to[M << 1], cap[M << 1];
double cost, dis[N], val[M << 1];
queue<int> q;
bool SPFA() {
  for (int i = 0; i <= T; ++i) inq[i] = 0, dis[i] = DBL_MAX;
  dis[S] = 0;
  incf[S] = INF;
  q.push(S);
  inq[S] = 1;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = head[u]; i; i = nt[i]) {
      int v = to[i];
      if (!cap[i]) continue;
      if (dis[v] > dis[u] + val[i]) {
        dis[v] = dis[u] + val[i];
        incf[v] = min(incf[u], cap[i]);
        pre[v] = i;
        if (!inq[v]) q.push(v);
      }
    }
    inq[u] = 0;
  }
  return dis[T] != DBL_MAX;
}
void update() {
  int x = T, y;
  while (x != S)
    y = pre[x], cap[y] -= incf[T], cap[y ^ 1] += incf[T], x = to[y ^ 1];
  ans += incf[T], cost += 1ll * incf[T] * dis[T];
}
void Add(int x, int y, int z, double w) {
  ++num;
  nt[num] = head[x];
  head[x] = num;
  to[num] = y;
  cap[num] = z;
  val[num] = w;
  ++num;
  nt[num] = head[y];
  head[y] = num;
  to[num] = x;
  cap[num] = 0;
  val[num] = -w;
}
double DIS(int a, int b) {
  return sqrt(((p[a].x - p[b].x) * (p[a].x - p[b].x)) +
              ((p[a].y - p[b].y) * (p[a].y - p[b].y)));
}
int main() {
  r(n);
  S = 0, T = n + n + 1;
  for (int i = 1; i <= n; ++i)
    r(p[i].x), r(p[i].y), Add(i, T, 1, 0), Add(S, i + n, 2, 0);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      if (p[j].y < p[i].y) Add(i + n, j, 1, DIS(i, j));
  while (SPFA()) update();
  if (ans != n - 1)
    puts("-1");
  else
    printf("%.10lf", cost);
  return 0;
}