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 inf = 0x3f3f3f3f;
const long double pi = acos(-1.0);
const string debug_line = "yolo";
const long double PI = acos((long double)-1.0);
const double InfCost = 1e99;
const int INF = 0x3f3f3f3f;
vector<pair<int, int> > points;
struct edge {
  int u, v;
  int flow;
  double cost;
  edge() {}
  edge(int u, int v, int f, double c) : u(u), v(v), flow(f), cost(c) {}
};
struct MinCostMaxFlow {
  int N;
  vector<vector<int> > G;
  vector<edge> E;
  int numEdges;
  vector<int> found, dad;
  vector<double> dist;
  MinCostMaxFlow(int N) : N(N), G(N), found(N), dist(N), dad(N), numEdges(0) {}
  void addEdge(int from, int to, int capacity, double cost) {
    G[from].push_back(numEdges++);
    E.push_back(edge(from, to, capacity, cost));
    G[to].push_back(numEdges++);
    E.push_back(edge(to, from, 0, double(-1) * cost));
  }
  bool spfa(int s, int t) {
    fill(dad.begin(), dad.end(), -1);
    fill(dist.begin(), dist.end(), INF);
    fill(found.begin(), found.end(), 0);
    queue<int> Q;
    dist[s] = 0;
    Q.push(s);
    found[s] = true;
    while (!Q.empty()) {
      int u = Q.front();
      Q.pop();
      if (u == t) continue;
      for (int i = 0; i < G[u].size(); ++i) {
        edge &pres = E[G[u][i]];
        int v = pres.v;
        if (pres.flow <= 0) continue;
        if (dist[u] + pres.cost < dist[v]) {
          dad[v] = G[u][i];
          dist[v] = dist[u] + pres.cost;
          if (!found[v]) Q.push(v), found[v] = true;
        }
      }
      found[u] = false;
    }
    return (dad[t] != -1);
  }
  int dfs(int s, int t) {
    int flow = INF;
    for (int i = dad[t]; i != -1; i = dad[E[i].u]) {
      if (E[i].flow < flow) flow = E[i].flow;
    }
    for (int i = dad[t]; i != -1; i = dad[E[i].u]) {
      E[i].flow -= flow;
      E[i ^ 1].flow += flow;
    }
    return flow;
  }
  pair<int, double> getMaxFlow(int s, int t) {
    int totflow = 0;
    double totcost = 0;
    while (spfa(s, t)) {
      int amt = dfs(s, t);
      totflow += amt;
      totcost += dist[t] * (double)amt;
    }
    return make_pair(totflow, totcost);
  }
};
int main() {
  int n;
  scanf("%d", &n);
  for (int(i) = (0); (i) < (n); ++(i)) {
    int x1, y1;
    scanf("%d%d", &x1, &y1);
    points.push_back(make_pair(x1, y1));
  }
  MinCostMaxFlow mcmf(2 * n + 2);
  int source = 2 * n;
  int sink = 2 * n + 1;
  for (int(i) = (0); (i) < (n); ++(i)) {
    mcmf.addEdge(source, i, 2, 0);
    mcmf.addEdge(i + n, sink, 1, 0);
  }
  for (int(i) = (0); (i) < (n); ++(i)) {
    for (int(j) = (0); (j) < (n); ++(j)) {
      if (i != j) {
        if (points[i].second > points[j].second) {
          double disx = points[i].second - points[j].second;
          double disy = points[i].first - points[j].first;
          disx = disx * disx;
          disy = disy * disy;
          mcmf.addEdge(i, n + j, 1, sqrt(disx + disy));
        }
      }
    }
  }
  pair<int, double> flowCost = mcmf.getMaxFlow(source, sink);
  if (flowCost.first == n - 1) {
    printf("%.6lf\n", flowCost.second);
  } else {
    printf("-1\n");
  }
  return 0;
}