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, class first>
inline bool checkbit(T a, first pos) {
  T t = 1;
  return ((a & (t << pos)) > 0);
}
template <class T, class first>
inline T setbit(T a, first pos) {
  T t = 1;
  return (a | (t << pos));
}
template <class T, class first>
inline T resetbit(T a, first pos) {
  T t = 1;
  return (a & (~(t << pos)));
}
template <class T, class first>
inline T togglebit(T a, first pos) {
  T t = 1;
  return (a ^ (t << pos));
}
template <typename T>
T POW(T B, T printf) {
  if (printf == 0) return 1;
  if (printf & 1)
    return B * POW(B, printf - 1);
  else
    return (POW(B, printf / 2) * POW(B, printf / 2));
}
template <typename T>
T Bigmod(T base, T power, T mod) {
  T ret = 1;
  while (power) {
    if (power & 1) ret = (ret * base) % mod;
    base = (base * base) % mod;
    power >>= 1;
  }
  return ret;
}
template <typename T>
T ModInverse(T number, T mod) {
  return Bigmod(number, mod - 2, mod);
}
template <typename T>
T GCD(T a, T b) {
  if (a < 0) return GCD(-a, b);
  if (b < 0) return GCD(a, -b);
  return (b == 0) ? a : GCD(b, a % b);
}
template <typename T>
T LCM(T a, T b) {
  if (a < 0) return LCM(-a, b);
  if (b < 0) return LCM(a, -b);
  return a * (b / GCD(a, b));
}
template <typename T>
T EUCLIDE(T a, T b, T &x, T &y) {
  if (a < 0) {
    T d = euclide(-a, b, x, y);
    x = -x;
    return d;
  }
  if (b < 0) {
    T d = euclide(a, -b, x, y);
    y = -y;
    return d;
  }
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  } else {
    T d = euclide(b, a % b, x, y);
    T t = x;
    x = y;
    y = t - (a / b) * y;
    return d;
  }
}
template <typename T>
T ABS(T a) {
  if (a < 0)
    return -a;
  else
    return a;
}
double DEG(double x) { return (180.0 * x) / ((2.0 * acos(0.0))); }
double RAD(double x) { return (x * (double)(2.0 * acos(0.0))) / (180.0); }
template <typename T>
double DIS(T x1, T y1, T x2, T y2) {
  return sqrt((double)((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
}
template <typename T>
T ANGLE(T x1, T y1, T x2, T y2) {
  return atan(double(y1 - y2) / double(x1 - x2));
}
template <typename T>
long long isLeft(T a, T b, T c) {
  return (c.x - a.x) * (b.y - a.y) - (b.x - a.x) * (c.y - a.y);
}
template <class T>
inline bool setmin(T &a, T b) {
  return a > b ? a = b, true : false;
}
template <class T>
inline bool setmax(T &a, T b) {
  return a < b ? a = b, true : false;
}
void P_ARR(int *ar, int a, int b) {
  if (a > b) swap(a, b);
  if (a <= b) cout << ar[a];
  for (int i = a + 1; i <= b; i++) cout << " " << ar[i];
  cout << endl;
}
template <typename T>
T in() {
  char ch;
  T n = 0;
  bool ng = false;
  while (1) {
    ch = getchar();
    if (ch == '-') {
      ng = true;
      ch = getchar();
      break;
    }
    if (ch >= '0' && ch <= '9') break;
  }
  while (1) {
    n = n * 10 + (ch - '0');
    ch = getchar();
    if (ch < '0' || ch > '9') break;
  }
  return (ng ? -n : n);
}
struct MinCostMaxFlow {
  struct node {
    int from, to, next, cap;
    double cst;
  } edge[502020];
  int head[807];
  int q[807], front, rear, avail, vn;
  int in[807], pre[807];
  double cost[807];
  bool vis[807];
  void init(int maxnode) {
    avail = 0;
    vn = maxnode;
    memset(head, -1, sizeof(head));
  }
  void insert(int from, int to, int cap, double cst) {
    edge[avail].from = from;
    edge[avail].to = to;
    edge[avail].cap = cap;
    edge[avail].cst = cst;
    edge[avail].next = head[from];
    head[from] = avail++;
    edge[avail].from = to;
    edge[avail].to = from;
    edge[avail].cap = 0;
    edge[avail].cst = -cst;
    edge[avail].next = head[to];
    head[to] = avail++;
  }
  bool spfa(int src, int des) {
    for (int i = 0; i <= vn; i++) cost[i] = 1e9;
    memset(vis, 0, sizeof(vis));
    memset(in, 0, sizeof(in));
    cost[src] = 0;
    pre[src] = -1;
    front = 0, rear = 1;
    q[front] = src;
    vis[src] = true;
    in[src]++;
    while (front != rear) {
      int u = q[front++], v;
      front %= 807;
      vis[u] = false;
      for (int i = head[u]; i != -1; i = edge[i].next) {
        v = edge[i].to;
        if (edge[i].cap > 0 && cost[v] > (1e-9) + cost[u] + edge[i].cst) {
          cost[v] = cost[u] + edge[i].cst;
          pre[v] = i;
          if (!vis[v]) {
            q[rear++] = v;
            rear %= 807;
            vis[v] = true;
            in[v]++;
            if (in[v] > vn) return false;
          }
        }
      }
    }
    if (cost[des] < 1000000000)
      return true;
    else
      return false;
  }
  pair<double, int> mincostmaxflow(int src, int des) {
    double mincost = 0;
    int i, j, maxflow = 0;
    while (spfa(src, des)) {
      int flow = 1000000000;
      for (i = pre[des]; i != -1; i = pre[edge[i].from]) {
        flow = min(flow, edge[i].cap);
      }
      maxflow += flow;
      for (i = pre[des]; i != -1; i = pre[edge[i].from]) {
        edge[i].cap -= flow;
        edge[i ^ 1].cap += flow;
      }
      mincost += cost[des] * flow;
    }
    return make_pair(mincost, maxflow);
  }
} MCMF;
int x[500], y[500];
int main() {
  int n;
  scanf("%d", &(n));
  for (int i = 1; i <= n; i++) scanf("%d%d", &(x[i]), &(y[i]));
  int src = 0;
  int des = n + n + 1;
  MCMF.init(des);
  for (int i = 1; i <= n; i++) {
    MCMF.insert(src, i, 2, 0.0);
    MCMF.insert(n + i, des, 1, 0.0);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (y[i] > y[j]) MCMF.insert(i, j + n, 1, DIS(x[i], y[i], x[j], y[j]));
    }
  }
  pair<double, int> res = MCMF.mincostmaxflow(src, des);
  if (res.second == n - 1)
    printf("%.7lf\n", res.first);
  else
    puts("-1");
  return 0;
}