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 <typename T, typename U>
inline void smin(T &a, U b) {
  if (a > b) a = b;
}
template <typename T, typename U>
inline void smax(T &a, U b) {
  if (a < b) a = b;
}
template <class T>
inline void gn(T &first) {
  char c, sg = 0;
  while (c = getchar(), (c > '9' || c < '0') && c != '-')
    ;
  for ((c == '-' ? sg = 1, c = getchar() : 0), first = 0; c >= '0' && c <= '9';
       c = getchar())
    first = (first << 1) + (first << 3) + c - '0';
  if (sg) first = -first;
}
template <class T, class T1>
inline void gn(T &first, T1 &second) {
  gn(first);
  gn(second);
}
template <class T, class T1, class T2>
inline void gn(T &first, T1 &second, T2 &z) {
  gn(first);
  gn(second);
  gn(z);
}
template <class T>
inline void print(T first) {
  if (first < 0) {
    putchar('-');
    return print(-first);
  }
  if (first < 10) {
    putchar('0' + first);
    return;
  }
  print(first / 10);
  putchar(first % 10 + '0');
}
template <class T>
inline void printsp(T first) {
  print(first);
  putchar(' ');
}
template <class T>
inline void println(T first) {
  print(first);
  putchar('\n');
}
template <class T, class U>
inline void print(T first, U second) {
  printsp(first);
  println(second);
}
template <class T, class U, class V>
inline void print(T first, U second, V z) {
  printsp(first);
  printsp(second);
  println(z);
}
int power(int a, int b, int m, int ans = 1) {
  for (; b; b >>= 1, a = 1LL * a * a % m)
    if (b & 1) ans = 1LL * ans * a % m;
  return ans;
}
int to[2001000], cap[2001000], nxt[2001000];
int head[10100], pre[10100];
int qf, qb, q[10100], ins[10100], E;
double cost[2001000], dst[10100];
void add_edge(int u, int v, int c, double c1) {
  to[E] = v;
  cap[E] = c;
  cost[E] = c1;
  nxt[E] = head[u];
  head[u] = E++;
  to[E] = u;
  cap[E] = 0;
  cost[E] = -c1;
  nxt[E] = head[v];
  head[v] = E++;
}
double min_cost(int src, int tar) {
  double ans = 0;
  int flow = 0;
  while (true) {
    for (int i = 0; i <= tar; i++) dst[i] = 1e100, ins[i] = 0;
    qf = qb = 0;
    q[qb++] = src;
    dst[src] = 0;
    ins[src] = 1;
    while (qf < qb) {
      int u = q[qf++];
      ins[u] = 0;
      for (int e = head[u]; ~e; e = nxt[e]) {
        int v = to[e];
        if (cap[e] < 1) continue;
        if (dst[v] > dst[u] + cost[e] + 1e-9) {
          dst[v] = dst[u] + cost[e];
          pre[v] = e;
          if (ins[v]) continue;
          ins[v] = 1;
          q[qb++] = v;
        }
      }
    }
    if (dst[tar] > 1e50) {
      if (flow == src / 2 - 1) return ans;
      puts("-1");
      exit(0);
    }
    int bot = 0x3f3f3f3f;
    for (int u = tar; u != src; u = to[pre[u] ^ 1]) smin(bot, cap[pre[u]]);
    flow += bot;
    ans += bot * dst[tar];
    for (int u = tar; u != src; u = to[pre[u] ^ 1]) {
      cap[pre[u]] -= bot;
      cap[pre[u] ^ 1] += bot;
    }
  }
}
double first[10100], second[10100];
int main() {
  int n;
  gn(n);
  for (int i = 0; i < n; i++) {
    scanf("%lf%lf", first + i, second + i);
  }
  double xx = *max_element(second, second + n);
  int cnt = 0, k = -1;
  for (int i = 0; i < n; i++)
    if (second[i] > xx - 1e-9) cnt++, k = i;
  if (cnt > 1) {
    puts("-1");
    return 0;
  }
  memset(head, -1, sizeof head);
  for (int i = 0; i < n; i++) {
    add_edge(n * 2, i, 2, 0);
    add_edge(i + n, n * 2 + 1, 1, 0);
    for (int j = 0; j < n; j++) {
      if (second[i] > second[j]) {
        add_edge(i, j + n, 1,
                 sqrt((first[i] - first[j]) * (first[i] - first[j]) +
                      (second[i] - second[j]) * (second[i] - second[j])));
      }
    }
  }
  printf("%.10lf\n", min_cost(n * 2, n * 2 + 1));
  return 0;
}