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>
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma comment(linker, "/STACK:16777216")
using namespace std;
using matrix = vector<vector<long long>>;
void FAST_IO() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.precision(20);
}
struct edge {
  int to;
  int flow;
  int cap;
  double cost;
  edge *rev;
  edge() : to(-1), flow(0), cap(0), cost(0), rev(nullptr){};
  edge(int _to, int _flow, int _cap, double _cost, edge *_rev = nullptr)
      : to(_to), flow(_flow), cap(_cap), cost(_cost), rev(_rev){};
};
const int INF = 1e9 + 7;
const int MAXN = 820;
int x[MAXN], y[MAXN];
vector<edge *> g[MAXN];
double d[MAXN], p[MAXN];
int mn[MAXN];
edge *par[MAXN];
bool used[MAXN];
int n, s, t;
double dist(int u, int v) {
  return sqrt((x[u] - x[v]) * (x[u] - x[v]) + (y[u] - y[v]) * (y[u] - y[v]));
}
void add_edge(int u, int v, int flow, int cap, double cost) {
  edge *uv = new edge(v, flow, cap, cost);
  edge *vu = new edge(u, 0, 0, -cost);
  uv->rev = vu;
  vu->rev = uv;
  g[u].push_back(uv);
  g[v].push_back(vu);
}
void Dijkstra() {
  fill(d, d + MAXN, INF);
  fill(mn, mn + MAXN, INF);
  fill(used, used + MAXN, false);
  d[s] = 0;
  par[s] = nullptr;
  priority_queue<pair<double, int>> q;
  for (int i = 0; i < 2 * n + 2; ++i) {
    q.push({-d[i], i});
  }
  while (!q.empty()) {
    int u = q.top().second;
    q.pop();
    if (used[u]) {
      continue;
    }
    used[u] = true;
    for (edge *e : g[u]) {
      if (e->flow == e->cap) {
        continue;
      }
      double cost = p[u] + e->cost - p[e->to];
      if (d[e->to] > d[u] + cost) {
        d[e->to] = d[u] + cost;
        par[e->to] = e;
        mn[e->to] = min(mn[u], e->cap - e->flow);
        q.push({-d[e->to], e->to});
      }
    }
  }
  for (int i = 0; i < 2 * n + 2; ++i) {
    p[i] = d[i] + p[i];
  }
}
void min_cost_max_flow() {
  Dijkstra();
  while (d[t] != INF) {
    int u = t;
    int delta = mn[t];
    while (par[u] != nullptr) {
      par[u]->flow += delta;
      par[u]->rev->flow -= delta;
      u = par[u]->rev->to;
    }
    Dijkstra();
  }
}
signed main() {
  FAST_IO();
  cin >> n;
  int mx = -INF, cnt = 0;
  for (int i = 0; i < n; ++i) {
    cin >> x[i] >> y[i];
    if (mx == -INF || y[i] > y[mx]) {
      mx = i;
      cnt = 1;
    } else if (mx != -INF && y[i] == y[mx]) {
      cnt++;
    }
  }
  if (cnt != 1) {
    cout << -1;
    return 0;
  }
  s = 2 * n;
  t = 2 * n + 1;
  for (int i = 0; i < n; ++i) {
    add_edge(s, i, 0, 2, 0);
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (y[i] > y[j]) {
        add_edge(i, j + n, 0, 1, dist(i, j));
      }
    }
  }
  for (int i = 0; i < n; ++i) {
    add_edge(i + n, t, 0, 1, 0);
  }
  min_cost_max_flow();
  int flow = 0;
  double cost = 0;
  for (edge *e : g[s]) {
    flow += e->flow;
  }
  for (int i = 0; i < n; ++i) {
    for (edge *e : g[i]) {
      cost += (e->flow == 1 ? e->cost : 0);
    }
  }
  if (flow != n - 1) {
    cout << -1;
  } else {
    cout << cost;
  }
}