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>
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');
}
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 N, first[1100], second[1100];
double cost[1100][1100], dis[1100], C;
int adj[1100][1100], deg[1100], cap[1100][1100], pre[1100];
int q[1100 * 10], qf, qb, src, tar;
double cal(int i, int j) {
  return sqrt((double)(first[i] - first[j]) * (first[i] - first[j]) +
              (double)(second[i] - second[j]) * (second[i] - second[j]));
}
void init() {
  memset(pre, -1, sizeof(pre));
  src = 0;
  tar = 2 * N + 1;
}
void add_edge(int u, int v, int c, double w) {
  adj[u][deg[u]++] = v;
  adj[v][deg[v]++] = u;
  cap[u][v] = c;
  cap[v][u] = 0;
  cost[u][v] = w;
  cost[v][u] = -w;
}
int mincost_maxflow() {
  int ans = 0, bot;
  while (1) {
    for (int i = 0; i <= 2 * N + 1; i++) dis[i] = 1e8;
    qf = qb = 0;
    dis[src] = 0;
    q[qb++] = src;
    while (qf < qb) {
      int u = q[qf++];
      for (int i = 0; i < deg[u]; i++) {
        int v = adj[u][i];
        if (cap[u][v] == 0) continue;
        if (dis[v] - dis[u] - cost[u][v] > 1e-8) {
          dis[v] = dis[u] + cost[u][v];
          q[qb++] = v;
          pre[v] = u;
        }
      }
    }
    if (dis[tar] >= 1e8) return ans;
    bot = 0x3f3f3f3f;
    for (int u = tar; u != src; u = pre[u]) bot = min(bot, cap[pre[u]][u]);
    for (int u = tar; u != src; u = pre[u]) {
      cap[pre[u]][u] -= bot;
      cap[u][pre[u]] += bot;
    }
    C += dis[tar];
    ans += bot;
  }
  return ans;
}
int main() {
  gn(N);
  for (int i = 1; i <= N; i++) {
    gn(first[i]);
    gn(second[i]);
  }
  init();
  for (int i = 1; i <= N; i++) {
    add_edge(src, i, 2, 0);
    add_edge(i + N, tar, 1, 0);
    for (int j = 1; j <= N; j++) {
      if (1e-8 < second[i] - second[j]) add_edge(i, j + N, 1, cal(i, j));
    }
  }
  if (mincost_maxflow() < N - 1)
    puts("-1");
  else
    printf("%.10lf\n", C);
  return 0;
}