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;
int n;
double ans = 0, cst = 0;
bool flag = false;
struct Edge {
  int from, to, cap, flow;
  double cost;
  Edge(int _from = 0, int _to = 0, int _cap = 0, int _flow = 0,
       double _cost = 0)
      : from(_from), to(_to), cap(_cap), flow(_flow), cost(_cost) {}
};
struct Point {
  int x, y;
  Point(int _x = 0, int _y = 0) : x(_x), y(_y) {}
  bool operator<(const Point &a) const {
    if (y == a.y) return x < a.x;
    return y > a.y;
  }
} p[405];
struct MCMF {
  static const int N = 800 + 5;
  static const int M = 320000 + 5;
  static const int oo = 0x3f3f3f3f;
  int n, m, s, t, tim, tot;
  int first[N], next[M];
  int u[M], v[M], cap[M];
  double cost[M], dis[N];
  bool vi[N];
  int cur[N];
  void Clear() {
    tot = 0;
    for (int i = 0; i <= n; ++i) first[i] = -1;
  }
  void Add(int from, int to, int cp, int flw, double ct) {
    u[tot] = from;
    v[tot] = to;
    cap[tot] = cp;
    cost[tot] = ct;
    next[tot] = first[u[tot]];
    first[u[tot]] = tot;
    tot++;
    u[tot] = to;
    v[tot] = from;
    cap[tot] = 0;
    cost[tot] = -ct;
    next[tot] = first[u[tot]];
    first[u[tot]] = tot;
    tot++;
  }
  int aug(int x, int f) {
    if (x == t) {
      ans += (double)cst * f;
      return f;
    }
    vi[x] = true;
    int tmp = f;
    for (int i = first[x]; i != -1; i = next[i])
      if (cap[i] && !vi[v[i]] && !cost[i]) {
        int delta = aug(v[i], tmp < cap[i] ? tmp : cap[i]);
        cap[i] -= delta;
        cap[i ^ 1] += delta;
        tmp -= delta;
        if (tmp == 0) return f;
      }
    return f - tmp;
  }
  bool modlabel() {
    double tmp = (double)oo;
    for (int i = 0; i <= n; ++i) {
      if (vi[i])
        for (int j = first[i]; j != -1; j = next[j])
          if (cap[j] && !vi[v[j]] && cost[j] < tmp) tmp = cost[j];
    }
    if (tmp == (double)oo) return false;
    for (int i = 0; i <= n; ++i)
      if (vi[i])
        for (int j = first[i]; j != -1; j = next[j])
          cost[j] -= tmp, cost[j ^ 1] += tmp;
    cst += tmp;
    return true;
  }
  void MinCostMaxFlow(int s, int t) {
    this->s = s;
    this->t = t;
    int flw, tot = 0;
    for (;;) {
      memset(vi, false, sizeof vi);
      while (flw = aug(s, oo)) {
        tot += flw;
        memset(vi, false, sizeof vi);
      }
      if (!modlabel()) break;
    }
    if (tot == (n / 2 - 1)) flag = true;
  }
} Net;
double dist(int i, int j) {
  return sqrt(pow(p[i].x - p[j].x, 2) + pow(p[i].y - p[j].y, 2));
}
int main() {
  scanf("%d", &n);
  Net.n = n * 2;
  Net.Clear();
  for (int i = 1; i <= n; ++i) scanf("%d%d", &p[i].x, &p[i].y);
  sort(p + 1, p + n + 1);
  for (int i = 1; i <= n; ++i) Net.Add(0, i, 1, 0, 0);
  for (int i = n + 1; i <= n + n; ++i) Net.Add(i, n + n + 1, 2, 0, 0);
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      if (p[i].y > p[j].y) Net.Add(j, i + n, 1, 0, dist(i, j));
    }
  }
  Net.MinCostMaxFlow(0, Net.n + 1);
  if (flag)
    printf("%.15lf\n", ans);
  else
    puts("-1");
  return 0;
}