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;
const int mod = (int)(1e9 + 7);
inline int read() {
  int f = 1, x = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  };
  return f * x;
}
inline void print(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) print(x / 10);
  putchar(x % 10 + 48);
}
template <typename T>
bool Chkmax(T &a, T b) {
  return a < b ? a = b, 1 : 0;
}
template <typename T>
bool Chkmin(T &a, T b) {
  return a > b ? a = b, 1 : 0;
}
void add(int &x, int y) { x = ((x % mod) + (y % mod)) % mod; }
void sub(int &x, int y) { x = ((x - y) % mod + mod) % mod; }
void mul(int &x, int y) { x = (long long)(x * y) % mod; }
const int Maxn = 500000 + 10;
int n, m, s, t;
struct Edge {
  int v, w, nxt, flow;
  double cost;
} e[Maxn];
Edge mkn(int v, int w, int nxt, int flow, double cost) {
  Edge x;
  x.v = v;
  x.w = w;
  x.nxt = nxt;
  x.flow = flow;
  x.cost = cost;
  return x;
}
int head[Maxn], Edgecnt = 0;
double dist[Maxn];
int lasts[Maxn], laste[Maxn], mine[Maxn];
bool inq[Maxn];
void Link(int u, int v, int w, double cost) {
  e[Edgecnt] = mkn(v, w, head[u], 0, cost), head[u] = Edgecnt++;
  e[Edgecnt] = mkn(u, 0, head[v], 0, -cost), head[v] = Edgecnt++;
}
bool Spfa() {
  queue<int> q;
  for (int i = s; i <= t; i++) {
    dist[i] = 1e15;
    inq[i] = 0;
    lasts[i] = laste[i] = -1;
    mine[i] = 0x3f3f3f3f;
  }
  q.push(s);
  inq[s] = 1;
  dist[s] = 0;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    inq[u] = false;
    for (int i = head[u]; i != -1; i = e[i].nxt) {
      int v = e[i].v, w = e[i].w, flow = e[i].flow;
      double cost = e[i].cost;
      if (dist[v] > dist[u] + cost && w > flow) {
        lasts[v] = u;
        laste[v] = i;
        mine[v] = min(mine[u], w - flow);
        dist[v] = dist[u] + cost;
        if (!inq[v]) {
          inq[v] = true;
          q.push(v);
        }
      }
    }
  }
  return lasts[t] != -1;
}
int MaxFlow = 0;
double MinCost = 0;
void upd() {
  int p = t;
  while (p != s) {
    e[laste[p]].flow += mine[t];
    e[laste[p] ^ 1].flow -= mine[t];
    p = lasts[p];
  }
  MaxFlow += mine[t];
  MinCost += 1.0 * mine[t] * dist[t];
}
double MCMF() {
  while (Spfa()) upd();
  return MinCost;
}
double x[Maxn], y[Maxn];
double dis(int a, int b) {
  return sqrt((x[a] - x[b]) * (x[a] - x[b]) + (y[a] - y[b]) * (y[a] - y[b]));
}
int main() {
  memset(head, -1, sizeof(head));
  n = read();
  for (int i = 1; i <= n; i++) cin >> x[i] >> y[i];
  s = 0, t = 2 * n + 1;
  for (int i = 1; i <= n; i++) {
    Link(s, i, 2, 0);
    Link(i + n, t, 1, 0);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (y[i] > y[j]) Link(i, j + n, 1, dis(i, j));
    }
  }
  double ans = MCMF();
  if (MaxFlow != n - 1) {
    cout << "-1\n";
    return 0;
  }
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}