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;
bool SR(int &_x) { return scanf("%d", &_x) == 1; }
bool SR(long long &_x) { return scanf("%lld", &_x) == 1; }
bool SR(double &_x) { return scanf("%lf", &_x) == 1; }
bool SR(char *_s) { return scanf("%s", _s) == 1; }
bool RI() { return true; }
template <typename I, typename... T>
bool RI(I &_x, T &..._tail) {
  return SR(_x) && RI(_tail...);
}
void SP(const int _x) { printf("%d", _x); }
void SP(const long long _x) { printf("%lld", _x); }
void SP(const double _x) { printf("%.15lf", _x); }
void SP(const char *s) { printf("%s", s); }
void PL() { puts(""); }
template <typename I, typename... T>
void PL(const I _x, const T... _tail) {
  SP(_x);
  if (sizeof...(_tail)) putchar(' ');
  PL(_tail...);
}
template <typename TF, typename TC, bool maxcost, size_t maxn>
struct Flow {
  struct Edge {
    int u, v;
    TF f;
    TC c;
    Edge(int _u, int _v, TF _f, TC _c) : u(_u), v(_v), f(_f), c(_c) {}
  };
  int n;
  vector<Edge> edge;
  vector<int> id[maxn];
  void init(int _n) {
    n = _n;
    edge.clear();
    for (int i = 0; i < int(n); i++) id[i].clear();
  }
  void add(int u, int v, TF f, TC c) {
    if (maxcost) c *= -1;
    id[u].push_back(((int)(edge).size()));
    edge.push_back(Edge(u, v, f, c));
    id[v].push_back(((int)(edge).size()));
    edge.push_back(Edge(v, u, 0, -c));
  }
  pair<bool, TC> spfa() {
    static TC dis[maxn];
    static int par[maxn];
    bitset<maxn> isq;
    queue<int> q;
    fill(dis, dis + n, numeric_limits<TC>::max());
    memset(par, -1, sizeof(int) * n);
    dis[0] = 0;
    isq[0] = 1;
    q.push(0);
    const TC eps = 5e-10;
    while (((int)(q).size())) {
      int u = q.front();
      q.pop();
      isq[u] = 0;
      for (int i : id[u])
        if (edge[i].f > 0) {
          const auto &e = edge[i];
          if (dis[e.v] > dis[u] + e.c + eps) {
            dis[e.v] = dis[u] + e.c;
            par[e.v] = i;
            if (!isq[e.v]) isq[e.v] = 1, q.push(e.v);
          }
        }
    }
    if (par[n - 1] == -1) return make_pair(false, 0);
    for (int u = n - 1; u; u = edge[par[u]].u)
      edge[par[u]].f--, edge[par[u] ^ 1].f++;
    if (maxcost) dis[n - 1] *= -1;
    return make_pair(true, dis[n - 1]);
  }
  pair<TF, TC> calc() {
    TF cnt = 0;
    TC ans = 0;
    while (1) {
      pair<bool, TC> sub = spfa();
      if (!sub.first) break;
      cnt++;
      ans += sub.second;
    }
    return make_pair(cnt, ans);
  }
};
const int maxn = 4e2 + 2;
int n, x[maxn], y[maxn];
void read() {
  RI(n);
  for (int i = (1); i <= int(n); i++) RI(x[i], y[i]);
}
Flow<int, double, 0, 1 + maxn + maxn + 1> flow;
void build() {
  flow.init(1 + n + n + 1);
  for (int i = (1); i <= int(n); i++) flow.add(0, i, 1, 0);
  for (int i = (1); i <= int(n); i++) flow.add(n + i, flow.n - 1, 2, 0);
  for (int i = (1); i <= int(n); i++)
    for (int j = (1); j <= int(n); j++)
      if (y[j] > y[i]) flow.add(i, n + j, 1, hypot(x[i] - x[j], y[i] - y[j]));
}
void sol() {
  auto res = flow.calc();
  if (res.first != n - 1)
    PL(-1);
  else
    PL(res.second);
}
int main() {
  read();
  build();
  sol();
  return 0;
}