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 long long INF = 1000LL * 1000 * 1000 * 1000 * 1000 * 1000;
const int N = 815;
struct Edge {
  int v, rev, c;
  long long koszt;
  Edge(int vv, int rrev, int cc, long long kkoszt)
      : v(vv), rev(rrev), c(cc), koszt(kkoszt) {}
  Edge() {}
};
vector<Edge> kraw[N];
int parent[N], parent_kraw[N];
long long used[N], dist[N], pot[N];
void AddEdge(int a, int b, int c, long long koszt) {
  kraw[a].push_back(Edge(b, (int)kraw[b].size() + (a == b), c, koszt));
  kraw[b].push_back(Edge(a, (int)kraw[a].size() - 1, 0, -koszt));
}
pair<int, long long> MinCostMaxFlow(int beg, int end, int n) {
  int res = 0;
  long long koszt = 0;
  for (int i = 0; i < (n); ++i) pot[i] = 0;
  while (1) {
    for (int i = 0; i < (n); ++i) dist[i] = INF, used[i] = 0;
    dist[beg] = 0;
    for (int k = 0; k < (n); ++k) {
      int best = -1;
      for (int i = 0; i < (n); ++i)
        if (!used[i] && (best == -1 || dist[i] < dist[best])) best = i;
      used[best] = 1;
      if (dist[best] == INF) break;
      for (__typeof((kraw[best]).begin()) it = (kraw[best]).begin();
           it != (kraw[best]).end(); ++it)
        if (it->c > 0) {
          long long x = it->koszt - pot[it->v] + pot[best];
          if (dist[it->v] > dist[best] + x) {
            dist[it->v] = dist[best] + x;
            parent[it->v] = best;
            parent_kraw[it->v] = it - kraw[best].begin();
          }
        }
    }
    if (dist[end] == INF) break;
    for (int i = 0; i < (n); ++i) dist[i] += pot[i], pot[i] = dist[i];
    int cap = 1000000;
    int x = end;
    do {
      cap = min(cap, kraw[parent[x]][parent_kraw[x]].c);
      x = parent[x];
    } while (x != beg);
    res += cap;
    x = end;
    do {
      koszt += kraw[parent[x]][parent_kraw[x]].koszt * (long long)cap;
      kraw[parent[x]][parent_kraw[x]].c -= cap;
      kraw[x][kraw[parent[x]][parent_kraw[x]].rev].c += cap;
      x = parent[x];
    } while (x != beg);
  }
  return make_pair(res, koszt);
}
const long long skala = 100000000;
long long dajkoszt(pair<int, int> a, pair<int, int> b) {
  return (long long)(hypotl(a.first - b.first, a.second - b.second) * skala);
}
int main() {
  int n;
  scanf("%d", &n);
  vector<pair<int, int> > v;
  for (int i = 0; i < (n); ++i) {
    int a, b;
    scanf("%d %d", &a, &b);
    v.push_back(make_pair(a, b));
  }
  for (int i = 0; i < (n); ++i) AddEdge(0, i + 1, 2, 0);
  for (int i = 0; i < (n); ++i) AddEdge(i + (n + 1), 2 * n + 1, 1, 0);
  for (int i = 0; i < (n); ++i)
    for (int j = 0; j < (n); ++j)
      if (v[i].second > v[j].second)
        AddEdge(i + 1, j + (n + 1), 1, dajkoszt(v[i], v[j]));
  pair<int, long long> p = MinCostMaxFlow(0, 2 * n + 1, 2 * n + 2);
  if (p.first != n - 1)
    printf("-1\n");
  else
    printf("%.12lf\n", (double)p.second / skala);
  return 0;
}