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>
namespace IO {
char buf[1 << 20 | 1], *f1 = buf, *f2 = buf, pbuf[1 << 24 | 1], *f3 = pbuf,
                       sta[100];
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
template <class T>
inline void write(T x) {
  if (!x) return (void)(*f3++ = 48, *f3++ = ' ');
  if (x < 0) *f3++ = '-', x = ~x + 1;
  char *top = sta;
  while (x) *top++ = x % 10 + 48, x /= 10;
  while (top != sta) *f3++ = *--top;
  *f3++ = ' ';
}
inline void put(std::string s) {
  int len = s.length();
  for (int i = 0; i < len; i++) *f3++ = s[i];
  *f3++ = ' ';
}
inline void endline() { *f3++ = '\n'; }
template <class T>
inline T abs(T a) {
  return a < 0 ? -a : a;
}
template <class T>
inline T max(T a, T b) {
  return a > b ? a : b;
}
template <class T>
inline T min(T a, T b) {
  return a < b ? a : b;
}
template <class T>
inline void swap(T &a, T &b) {
  T t = a;
  a = b;
  b = t;
}
}  // namespace IO
using namespace IO;
const int N = 420;
int n, S, T, cnt = 1;
int head[N << 1], pre[N << 1], f[N << 1], vis[N << 1];
double x[N], y[N], dis[N << 1];
struct edge {
  int v, nex, c;
  double val;
} e[(N * N) << 3];
inline void add(int u, int v, int c, double val) {
  e[++cnt].v = v;
  e[cnt].nex = head[u];
  e[cnt].c = c;
  e[cnt].val = val;
  head[u] = cnt;
  e[++cnt].v = u;
  e[cnt].nex = head[v];
  e[cnt].c = 0;
  e[cnt].val = -val;
  head[v] = cnt;
}
inline double calc(int i, int j) {
  return sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]));
}
std::queue<int> q;
bool spfa() {
  for (int i = 1; i <= T; ++i) dis[i] = 1e16, pre[i] = 0;
  f[S] = 1e8;
  dis[S] = 0;
  q.push(S);
  while (q.size()) {
    int x = q.front();
    q.pop();
    vis[x] = 0;
    for (int i = head[x], v; i; i = e[i].nex) {
      v = e[i].v;
      if (e[i].c && dis[v] > dis[x] + e[i].val) {
        dis[v] = dis[x] + e[i].val;
        f[v] = min(f[x], e[i].c);
        pre[v] = i;
        if (!vis[v]) vis[v] = 1, q.push(v);
      }
    }
  }
  return dis[T] != 1e16;
}
int main() {
  n = read();
  S = n * 2 + 1;
  T = S + 1;
  for (int i = 1; i <= n; ++i) scanf("%lf%lf", &x[i], &y[i]);
  for (int i = 1; i <= n; ++i) add(S, i, 2, 0), add(i + n, T, 1, 0);
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      if (i != j && y[i] > y[j]) add(i, j + n, 1, calc(i, j));
  int flow = 0;
  double ans = 0;
  while (spfa()) {
    flow += f[T];
    ans += dis[T] * f[T];
    int t = T, i;
    do i = pre[t], e[i].c -= f[T], e[i ^ 1].c += f[T], t = e[i ^ 1].v;
    while (t != S);
  }
  if (flow != n - 1)
    puts("-1");
  else
    printf("%.15f\n", ans);
  return 0;
}