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;
vector<pair<pair<int, int>, pair<int, double> > > edge;
int anti[9 * (int)(805) * (int)(805)];
vector<int> arr[(int)(805)];
int i, j, k, n, m, x, y, z;
pair<int, int> A[(int)(805)];
int source, sink, wh[(int)(805)];
double ans;
int ok, mn, H[(int)(805)], mn2, ans2, q[(int)(805) * 300];
double H2[(int)(805)], pot[(int)(805)];
double dist(pair<int, int> x, pair<int, int> y) {
  return sqrt((x.first - y.first) * (x.first - y.first) +
              (x.second - y.second) * (x.second - y.second));
}
void add_edge(int x, int y, int cap, double cost) {
  int s = edge.size();
  anti[s] = s + 1;
  anti[s + 1] = s;
  edge.push_back(make_pair(make_pair(x, y), make_pair(cap, cost)));
  edge.push_back(make_pair(make_pair(y, x), make_pair(0, -cost)));
  arr[x].push_back(s);
  arr[y].push_back(s + 1);
}
void reverse_edges() {
  int x = sink, p = 1000000007;
  while (x != source) {
    if (wh[x] == -1) return;
    int y = edge[wh[x]].first.first;
    p = min(edge[wh[x]].second.first, p);
    x = y;
  }
  x = sink;
  while (x != source) {
    if (wh[x] == -1) return;
    int y = edge[wh[x]].first.first;
    ans += p * edge[wh[x]].second.second;
    edge[anti[wh[x]]].second.first += p;
    edge[wh[x]].second.first -= p;
    x = y;
  }
  ans2 += p;
}
void ford() {
  memset(wh, -1, sizeof wh);
  for (i = 1; i <= 2 * n + 2; i++) H2[i] = 1e20;
  H2[source] = 0;
  memset(H, 0, sizeof H);
  int s = 0;
  priority_queue<pair<double, int> > xx;
  xx.push(make_pair(0, source));
  while (xx.size()) {
    int x = xx.top().second;
    xx.pop();
    if (H[x]) continue;
    H[x] = 1;
    for (int i = (int)arr[x].size() - 1; i >= 0; i--) {
      int t = arr[x][i];
      int y = edge[t].first.second;
      double cost = edge[t].second.second;
      if (edge[t].second.first > 0 and
          H2[y] > H2[x] + cost + pot[x] - pot[y] and !H[y]) {
        H2[y] = H2[x] + cost + pot[x] - pot[y];
        wh[y] = t;
        xx.push(make_pair(-H2[y], y));
      }
    }
  }
  for (i = 1; i <= 2 * n + 2; i++) pot[i] += H2[i];
}
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> A[i].second >> A[i].first;
  }
  sort(A + 1, A + 1 + n);
  reverse(A + 1, A + 1 + n);
  source = 2 * n + 1;
  sink = 2 * n + 2;
  for (i = 1; i <= n; i++) {
    add_edge(source, i, 2, 0);
    add_edge(i + n, sink, 1, 0);
    for (j = i + 1; j <= n; j++)
      if (A[i].first > A[j].first) add_edge(i, j + n, 1, dist(A[i], A[j]));
  }
  while (1) {
    mn2 = 1000000007;
    ford();
    if (H2[sink] >= 1e20 - 0.00000001) break;
    reverse_edges();
    ans2 += mn;
  }
  if (ans2 == n - 1) {
    cout << setprecision(10) << fixed << ans << '\n';
  } else
    puts("-1");
}