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;
template <class T>
inline bool Up(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool Down(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
inline int getus() {
  int tmp, c;
  while (tmp = fgetc(stdin), tmp < '0' || tmp > '9')
    ;
  tmp -= '0';
  while (c = fgetc(stdin), '0' <= c && c <= '9') tmp = tmp * 10 + c - '0';
  return tmp;
}
inline int getint() {
  int tmp, c, flag;
  while (flag = fgetc(stdin), flag != '-' && (flag < '0' || flag > '9'))
    ;
  if (flag == '-')
    tmp = 0;
  else
    tmp = flag - '0';
  while (c = fgetc(stdin), '0' <= c && c <= '9') tmp = tmp * 10 + c - '0';
  return flag == '-' ? -tmp : tmp;
}
struct Vec {
  int x, y;
} P[513];
namespace Heap {
pair<double, int> base[330022];
int size;
inline bool cmp(const pair<double, int> &a, const pair<double, int> &b) {
  return a > b;
}
void push(double a, int b) {
  base[++size] = make_pair(a, b);
  push_heap(base + 1, base + size + 1, cmp);
}
void pop() {
  pop_heap(base + 1, base + size + 1, cmp);
  --size;
}
}  // namespace Heap
int N, tot, S, T, pe[1025];
int c[1025][1025];
double w[1025][1025], dist[1025];
double cost(0.0);
int main() {
  N = getus();
  S = 0;
  T = 2 * N + 1;
  tot = 2 * N;
  memset(w, 63, sizeof(w));
  for (int i = (1); i <= (N); ++i) {
    P[i].x = getint();
    P[i].y = getint();
    c[S][i] = 1;
    c[i + N][T] = 2;
    w[S][i] = 0;
    w[i + N][T] = 0;
  }
  for (int x = (1); x <= (N); ++x)
    for (int y = (1); y <= (N); ++y)
      if (P[x].y < P[y].y) {
        w[x][y + N] = hypot(P[x].x - P[y].x, P[x].y - P[y].y);
        w[y + N][x] = -w[x][y + N];
        c[x][y + N] = 1;
      }
  for (int restFlow = N - 1; restFlow--;) {
    for (int i = (S); i <= (T); ++i) dist[i] = 1000000000;
    Heap::size = 0;
    for (Heap::push(dist[S] = 0, S); Heap::size;) {
      int x = Heap::base[1].second, b, e;
      double d = Heap::base[1].first;
      Heap::pop();
      if (d != dist[x]) continue;
      if (1 <= x && x <= N)
        b = N + 1, e = N + N;
      else if (N <= x && x <= N + N) {
        b = 1, e = N;
        if (c[x][T] && Down(dist[T], dist[x])) {
          Heap::push(dist[T], T);
          pe[T] = x;
        }
      } else if (x == 0)
        b = 1, e = N;
      else
        b = N + 1, e = N + N;
      for (int y = b; y <= e; ++y)
        if (c[x][y])
          if (Down(dist[y], dist[x] + w[x][y])) {
            Heap::push(dist[y], y);
            pe[y] = x;
          }
    }
    if (dist[T] >= 1000000000) {
      puts("-1");
      return 0;
    }
    cost += dist[T];
    for (int x = T, y; x != S; x = y) {
      y = pe[x];
      --c[y][x];
      ++c[x][y];
    }
  }
  printf("%.8f\n", cost);
  return 0;
}