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 = INT_MAX;
const int maxn = 4005;
struct edge {
  long long to, cap;
  long double cost;
  long long flow;
  size_t back;
};
vector<vector<edge> > g(maxn);
void add_edge(long long a, long long to, long long cap, long double cost) {
  edge r1 = {to, cap, cost, 0, g[to].size()};
  edge r2 = {a, 0, -cost, 0, g[a].size()};
  g[a].push_back(r1);
  g[to].push_back(r2);
}
long double min_cost_flow(int n, int s, int t, long long k) {
  long long flow = 0;
  long double cost = 0;
  while (flow < k) {
    vector<long long> id(n, 0);
    vector<long double> d(n, INF);
    vector<long long> q(n);
    vector<long long> p(n);
    vector<size_t> p_edge(n);
    long long qh = 0, qt = 0;
    q[qt++] = s;
    d[s] = 0;
    while (qh != qt) {
      long long v = q[qh++];
      id[v] = 2;
      if (qh == n) qh = 0;
      for (size_t i = 0; i < g[v].size(); ++i) {
        edge& r = g[v][i];
        if (r.flow < r.cap && d[v] + r.cost < d[r.to]) {
          d[r.to] = d[v] + r.cost;
          if (id[r.to] == 0) {
            q[qt++] = r.to;
            if (qt == n) qt = 0;
          } else if (id[r.to] == 2) {
            if (--qh == -1) qh = n - 1;
            q[qh] = r.to;
          }
          id[r.to] = 1;
          p[r.to] = v;
          p_edge[r.to] = i;
        }
      }
    }
    if (d[t] == INF) break;
    long long addflow = k - flow;
    for (long long v = t; v != s; v = p[v]) {
      long long pv = p[v];
      size_t pr = p_edge[v];
      addflow = min(addflow, g[pv][pr].cap - g[pv][pr].flow);
    }
    for (long long v = t; v != s; v = p[v]) {
      long long pv = p[v];
      size_t pr = p_edge[v], r = g[pv][pr].back;
      g[pv][pr].flow += addflow;
      g[v][r].flow -= addflow;
      cost += g[pv][pr].cost * addflow;
    }
    flow += addflow;
  }
  if (flow < k) return -1;
  return cost;
}
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  pair<long long, long long> a[n + 1];
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
    add_edge(0, i + 1, 2, 0);
  }
  int last = n;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i == j || a[i].second <= a[j].second) continue;
      long double d =
          (a[i].second - a[j].second) * (a[i].second - a[j].second) +
          (a[i].first - a[j].first) * (a[i].first - a[j].first);
      d = sqrtl(d);
      add_edge(i + 1, n + 1 + j, 1, d);
    }
  }
  for (int i = 0; i < n; i++) {
    add_edge(n + i + 1, last + n + 1, 1, 0);
  }
  long double ans = min_cost_flow(last + n + 2, 0, last + n + 1, n - 1);
  if (ans < 0) {
    cout << "-1\n";
    return 0;
  }
  cout << setprecision(8) << fixed << ans << "\n";
  return 0;
}