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;
struct Edge {
  int n, f, c;
  double v;
  Edge(int n = 0, int f = 0, int c = 0, double v = .0)
      : n(n), f(f), c(c), v(v) {}
};
int N, lim, maxFlow, last[2 * 410], from, to, pt[2 * 410];
bool mk[2 * 410];
double ans, d[2 * 410], eps = 1e-15;
vector<Edge> E;
vector<pair<int, int> > P;
vector<int> G[2 * 410];
queue<int> Q;
bool build() {
  for (int i = from; i <= to; ++i)
    d[i] = 1000000000, last[i] = -1, mk[i] = false;
  d[from] = 0.0;
  Q.push(from);
  for (int nod, nxt; !Q.empty(); Q.pop()) {
    nod = Q.front();
    for (int id : G[nod]) {
      nxt = E[id].n;
      if (E[id].c - E[id].f >= lim && d[nxt] - d[nod] - E[id].v > eps) {
        d[nxt] = d[nod] + E[id].v;
        last[nxt] = nod;
        Q.push(nxt);
      }
    }
  }
  return d[to] != 1000000000;
}
bool push(int nod, int flow) {
  if (!flow) return false;
  if (nod == to) return true;
  for (int id, nxt; pt[nod] < G[nod].size(); ++pt[nod]) {
    id = G[nod][pt[nod]];
    nxt = E[id].n;
    if (E[id].c - E[id].f >= flow && nod == last[nxt] && push(nxt, flow)) {
      E[id].f += flow;
      E[id ^ 1].f -= flow;
      ans += E[id].v;
      return true;
    }
  }
  return false;
}
void dinic() {
  for (lim = 1024; lim > 0;) {
    if (!build())
      lim >>= 1;
    else {
      for (int i = from; i <= to; ++i) pt[i] = 0;
      while (push(from, lim)) maxFlow += lim;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL), cout.tie(NULL);
  cin >> N;
  from = 0;
  to = 2 * N + 1;
  for (int i = 1, a, b; i <= N; ++i) cin >> a >> b, P.push_back({a, b});
  for (int i = 0; i < N; ++i) {
    G[from].push_back(E.size());
    E.push_back(Edge(i + 1, 0, 2, 0.0));
    G[i + 1].push_back(E.size());
    E.push_back(Edge(from, 2, 2, 0.0));
  }
  for (int i = 0; i < N; ++i)
    for (int j = 0; j < N; ++j)
      if (P[i].second > P[j].second) {
        G[i + 1].push_back(E.size());
        E.push_back(Edge(j + 1 + N, 0, 1,
                         sqrt(pow(abs(P[i].first - P[j].first), 2) +
                              pow(abs(P[i].second - P[j].second), 2))));
        G[j + 1 + N].push_back(E.size());
        E.push_back(Edge(i + 1, 1, 1,
                         -sqrt(pow(abs(P[i].first - P[j].first), 2) +
                               pow(abs(P[i].second - P[j].second), 2))));
      }
  for (int i = N + 1; i <= 2 * N; ++i) {
    G[i].push_back(E.size());
    E.push_back(Edge(to, 0, 1, 0.0));
    G[to].push_back(E.size());
    E.push_back(Edge(i, 1, 1, 0.0));
  }
  dinic();
  if (maxFlow != N - 1) return !printf("-1\n");
  cout << fixed << setprecision(15) << ans << '\n';
  return 0;
}