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;
namespace io {
const int N = 1 << 20;
char buf[N], *t1 = buf, *t2 = buf;
inline int read() {
  static int an, f;
  an = 0, f = 1;
  static char ch;
  ch = t1 == t2 && (t2 = (t1 = buf) + fread(buf, 1, N, stdin), t1 == t2)
           ? EOF
           : *t1++;
  while (ch < 48 || ch > 57)
    ch == '-' ? f = -1 : 0,
                ch = t1 == t2 && (t2 = (t1 = buf) + fread(buf, 1, N, stdin),
                                  t1 == t2)
                         ? EOF
                         : *t1++;
  while (ch >= 48 && ch <= 57)
    an = (an << 3) + (an << 1) + (ch ^ 48),
    ch = t1 == t2 && (t2 = (t1 = buf) + fread(buf, 1, N, stdin), t1 == t2)
             ? EOF
             : *t1++;
  return an * f;
}
char buff[N], *T = buff;
void flush() {
  fwrite(buff, 1, T - buff, stdout);
  T = buff;
}
inline void putc(char ch) {
  if (T == buff + N) flush();
  *T++ = ch;
}
template <typename o>
inline void print(o x) {
  if (x < 0) putc('-'), x = -x;
  if (!x) return putc('0'), void();
  static int st[20], tp;
  while (x) st[++tp] = x % 10, x /= 10;
  while (tp) putc(st[tp] ^ 48), --tp;
}
}  // namespace io
using io::flush;
using io::print;
using io::putc;
using io::read;
namespace mcmf {
const int S = 0, T = 1;
struct edge {
  int nxt, to, f;
  double w;
} e[500010];
int head[1010], num = 1, fb[1010], tot = 1;
double dis[1010];
inline void add(int from, int to, int f, double w) {
  e[++num] = edge{head[from], to, f, w};
  head[from] = num;
}
inline void ADD(int from, int to, int f, double w) {
  add(from, to, f, w), add(to, from, 0, -w);
}
bool spfa() {
  queue<int> q;
  static bool in[1010];
  for (int i = 0; i < tot; ++i) dis[i] = 1e18;
  q.push(S);
  dis[S] = 0;
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    in[x] = 0;
    for (int i = head[x], y; i; i = e[i].nxt)
      if (e[i].f && dis[x] + e[i].w < dis[y = e[i].to]) {
        dis[y] = dis[x] + e[i].w, fb[y] = i;
        if (!in[y]) in[y] = 1, q.push(y);
      }
  }
  return dis[T] != 1e18;
}
}  // namespace mcmf
using namespace mcmf;
struct point {
  int x, y;
} p[410];
double qdis(point x, point y) {
  return sqrt(1ll * (x.x - y.x) * (x.x - y.x) +
              1ll * (x.y - y.y) * (x.y - y.y));
}
int n;
int main() {
  n = read();
  for (int i = 1; i <= n; ++i) p[i].x = read(), p[i].y = read();
  int mx = 1, cnt = 1;
  for (int i = 2; i <= n; ++i) {
    if (p[i].y > p[mx].y)
      mx = i, cnt = 1;
    else if (p[i].y == p[mx].y)
      ++cnt;
  }
  if (cnt >= 2) return printf("-1"), 0;
  for (int i = 1; i <= n; ++i) {
    ADD(S, i + 1, 2, 0);
    ADD(i + 1 + n, T, 1, 0);
    for (int j = 1; j <= n; ++j)
      if (p[j].y < p[i].y) ADD(i + 1, j + n + 1, 1, qdis(p[i], p[j]));
  }
  ADD(S, mx + 1 + n, 1, 0);
  tot = 2 * n + 2;
  int flow = 0;
  double cost = 0;
  while (spfa()) {
    ++flow;
    cost += dis[T];
    int x = T;
    while (x != S) --e[fb[x]].f, ++e[fb[x] ^ 1].f, x = e[fb[x] ^ 1].to;
  }
  if (flow != n)
    printf("-1");
  else
    printf("%.12lf", cost);
  flush();
  return 0;
}