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;
const int MAXV = 1005;
const int MAXE = MAXV * MAXV * 2;
const double INF = 1e9;
struct POINT {
  int x, y;
} mp[MAXV];
struct EDGE {
  int to, next, cap;
  double cost;
} edge[MAXE];
int V, N;
int head[MAXV];
double dist[MAXV];
int prevv[MAXV], preve[MAXV];
int n;
void AddEdge(int from, int to, int cap, double cost) {
  edge[N].to = to;
  edge[N].cost = cost;
  edge[N].next = head[from];
  edge[N].cap = cap;
  head[from] = N++;
}
void add(int from, int to, int cap, double cost) {
  AddEdge(from, to, cap, cost);
  AddEdge(to, from, 0, -cost);
}
queue<int> Q;
bool vis[MAXV];
double min_cost_flow(int s, int t, int &f) {
  double res = 0;
  while (true) {
    for (int i = 0; i < V; i++) dist[i] = INF;
    dist[s] = 0;
    memset(vis, 0, sizeof(vis));
    vis[s] = 1;
    while (!Q.empty()) Q.pop();
    Q.push(s);
    while (!Q.empty()) {
      int v = Q.front();
      Q.pop();
      vis[v] = 0;
      for (int i = head[v]; i != -1; i = edge[i].next) {
        EDGE &e = edge[i];
        if (e.cap > 1e-5 && dist[e.to] > dist[v] + e.cost) {
          dist[e.to] = dist[v] + e.cost;
          prevv[e.to] = v;
          preve[e.to] = i;
          if (!vis[e.to]) {
            vis[e.to] = 1;
            Q.push(e.to);
          }
        }
      }
    }
    if (dist[t] > 1e6) return res;
    int d = INF;
    for (int v = t; v != s; v = prevv[v]) d = min(d, edge[preve[v]].cap);
    f += d;
    res += (double)d * dist[t];
    for (int v = t; v != s; v = prevv[v]) {
      edge[preve[v]].cap -= d;
      edge[preve[v] ^ 1].cap += d;
    }
  }
}
double sqr(double x) { return x * x; }
double get_dis(int i, int j) {
  return sqrt(sqr(mp[i].x - mp[j].x) + sqr(mp[i].y - mp[j].y));
}
void build_edge() {
  memset(head, -1, sizeof(head));
  N = 0;
  V = 2 * n + 2;
  for (int i = 1; i <= n; i++) add(0, i, 2, 0);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (mp[j].y < mp[i].y) add(i, j + n, 1, get_dis(i, j));
  for (int i = n + 1; i <= n + n; i++) add(i, V - 1, 1, 0);
}
void input() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &mp[i].x, &mp[i].y);
}
void solve() {
  int flow = 0;
  double ans = min_cost_flow(0, V - 1, flow);
  if (flow == n - 1)
    printf("%.9f\n", ans);
  else
    printf("-1\n");
}
int main() {
  input();
  build_edge();
  solve();
  return 0;
}