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>
const int inf = 1e9;
using namespace std;
struct data {
  int obj, pre, c;
  double w;
} e[200500 * 2];
int head[200500], cur[200500], uu[200500], c[200500];
double dis[200500];
int n, tot = 1, s, t;
double ans = 0;
struct node {
  double x, y;
} a[200500];
void insert(int x, int y, int c, double w) {
  e[++tot].obj = y;
  e[tot].pre = head[x];
  e[tot].c = c;
  e[tot].w = w;
  head[x] = tot;
  e[++tot].obj = x;
  e[tot].pre = head[y];
  e[tot].c = 0;
  e[tot].w = -w;
  head[y] = tot;
}
bool spfa() {
  for (int i = 0; i <= t; i++) uu[i] = 0;
  for (int i = 0; i <= t; i++) dis[i] = 1.0 * inf;
  dis[0] = 0;
  queue<int> q;
  q.push(0);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    uu[u] = 1;
    for (int j = head[u]; j; j = e[j].pre) {
      int v = e[j].obj;
      if (e[j].c > 0 && dis[v] > dis[u] + e[j].w + 1e-9) {
        dis[v] = dis[u] + e[j].w;
        if (uu[v] == 0) uu[v] = 1, q.push(v);
      }
    }
    uu[u] = 0;
  }
  if (dis[t] >= 1.0 * inf) return 0;
  return 1;
}
int dfs(int x, int mx) {
  if (x == t || mx == 0) return mx;
  uu[x] = 1;
  int used = 0;
  for (int j = cur[x]; j; j = e[j].pre) {
    int v = e[j].obj;
    if (fabs(dis[v] - (dis[x] + e[j].w)) < 1e-9 && e[j].c > 0 && uu[v] == 0) {
      int w = dfs(v, min(e[j].c, mx - used));
      ans += 1.0 * w * e[j].w;
      e[j].c -= w;
      e[j ^ 1].c += w;
      used += w;
      cur[x] = j;
      if (used == mx) return used;
    }
  }
  return used;
}
double sqr(double x) { return x * x; }
double D(node a, node b) { return sqrt(sqr(a.x - b.x) + sqr(a.y - b.y)); }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lf%lf", &a[i].x, &a[i].y);
  s = 0;
  t = 2 * n + 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (a[i].y > a[j].y) insert(i, j + n, 1, D(a[i], a[j]));
  for (int i = 1; i <= n; i++) insert(s, i, 2, 0);
  for (int i = 1; i <= n; i++) insert(i + n, t, 1, 0);
  int flow = 0;
  while (spfa()) {
    for (int i = 0; i <= t; i++) cur[i] = head[i], uu[i] = 0;
    flow += dfs(s, inf);
  }
  if (flow != n - 1)
    puts("-1");
  else
    printf("%.10lf\n", ans);
  return 0;
}