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>
#pragma comment(linker, "/STACK:1024000000,1024000000")
using namespace std;
struct Node {
  int x, y, idx;
  bool operator<(const Node n) const { return y > n.y; }
} p[400];
struct node {
  int u, v, f, next;
  double c;
} edge[500005];
int nn, idx = 0;
int start[1005], vis[1005], pre[1005];
double dist[1005];
vector<vector<Node> > dep;
void _addedge(int u, int v, int flow, double cost) {
  edge[idx].u = u;
  edge[idx].v = v;
  edge[idx].f = flow;
  edge[idx].c = cost;
  edge[idx].next = start[u];
  start[u] = idx++;
}
void addedge(int u, int v, int flow, double cost) {
  _addedge(u, v, flow, cost);
  _addedge(v, u, 0, -cost);
}
bool spfa(int s, int e, int n) {
  queue<int> que;
  for (int i = 0; i < n; i++) {
    dist[i] = 1000000005;
    vis[i] = 0;
    pre[i] = -1;
  }
  que.push(s);
  dist[s] = 0;
  vis[s] = 1;
  while (!que.empty()) {
    int u = que.front();
    que.pop();
    vis[u] = 0;
    for (int i = start[u]; i != -1; i = edge[i].next)
      if (edge[i].f) {
        int v = edge[i].v;
        if (dist[v] > dist[u] + edge[i].c) {
          dist[v] = dist[u] + edge[i].c;
          pre[v] = i;
          if (!vis[v]) {
            vis[v] = 1;
            que.push(v);
          }
        }
      }
  }
  return fabs(dist[e] - 1000000005) > 1e-8;
}
double MaxCostFlow(int s, int e, int n) {
  int flow = 1000000005, Flow = 0;
  double ans = 0;
  while (spfa(s, e, n)) {
    ans += dist[e];
    for (int i = pre[e]; i != -1; i = pre[edge[i].u])
      flow = min(flow, edge[i].f);
    for (int i = pre[e]; i != -1; i = pre[edge[i].u]) {
      edge[i].f -= flow;
      edge[i ^ 1].f += flow;
    }
    Flow += flow;
  }
  return Flow != nn - 1 ? -1 : ans;
}
double Dist(Node n1, Node n2) {
  return sqrt(((n1.x - n2.x) * (n1.x - n2.x)) +
              ((n1.y - n2.y) * (n1.y - n2.y)));
}
int main() {
  idx = 0;
  memset(start, -1, sizeof(start));
  cin >> nn;
  int root, cnt = 0;
  for (int i = 0; i < nn; i++) {
    cin >> p[i].x >> p[i].y;
    if (i == 0)
      root = i, cnt = 1;
    else if (p[i].y > p[root].y)
      root = i, cnt = 1;
    else if (p[i].y == p[root].y)
      cnt++;
  }
  if (cnt > 1) {
    puts("-1");
    return 0;
  }
  for (int i = 0; i < nn; i++) {
    addedge(0, i + 1, 2, 0);
    addedge(i + 1 + nn, 2 * nn + 1, 1, 0);
  }
  for (int i = 0; i < nn; i++)
    for (int j = 0; j < nn; j++)
      if (p[i].y > p[j].y) addedge(i + 1, j + nn + 1, 1, Dist(p[i], p[j]));
  printf("%.10f\n", MaxCostFlow(0, 2 * nn + 1, 2 * nn + 2));
  return 0;
}