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 <int POS, class TUPLE>
void deploy(std::ostream &os, const TUPLE &tuple) {}
template <int POS, class TUPLE, class H, class... Ts>
void deploy(std::ostream &os, const TUPLE &t) {
  os << (POS == 0 ? "" : ", ") << get<POS>(t);
  deploy<POS + 1, TUPLE, Ts...>(os, t);
}
template <class T, class U>
std::ostream &operator<<(std::ostream &os, std::pair<T, U> &p) {
  os << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <class T>
std::ostream &operator<<(std::ostream &os, std::vector<T> &v) {
  int remain = v.size();
  os << "{";
  for (auto e : v) os << e << (--remain == 0 ? "}" : ", ");
  return os;
}
template <class T>
std::ostream &operator<<(std::ostream &os, std::set<T> &v) {
  int remain = v.size();
  os << "{";
  for (auto e : v) os << e << (--remain == 0 ? "}" : ", ");
  return os;
}
template <class T, class K>
std::ostream &operator<<(std::ostream &os, std::map<T, K> &make_pair) {
  int remain = make_pair.size();
  os << "{";
  for (auto e : make_pair)
    os << "(" << e.first << " -> " << e.second << ")"
       << (--remain == 0 ? "}" : ", ");
  return os;
}
using ll = long long;
template <class T>
class MinCostFlow {
 public:
  struct edge {
    int to, cap;
    T cost;
    int reve;
  };
  static const int MV = 1000;
  vector<edge> E[MV];
  T dist[MV], mav;
  int prev_v[MV], prev_e[MV], NV;
  MinCostFlow() {
    init(MV);
    mav = 1e9;
  }
  void init(int NV = MV) {
    this->NV = NV;
    for (int i = 0; i < MV; i++) E[i].clear();
  }
  void add_edge(int x, int y, int cap, T cost) {
    E[x].push_back((edge){y, cap, cost, (int)E[y].size()});
    E[y].push_back((edge){x, 0, -cost, (int)E[x].size() - 1});
  }
  T mincost(int from, int to, int flow) {
    T res = 0;
    memset(prev_v, 0, sizeof(prev_v));
    memset(prev_e, 0, sizeof(prev_e));
    while (flow > 0) {
      fill(dist, dist + NV, mav);
      dist[from] = 0;
      bool up = true;
      while (up) {
        up = false;
        for (int v = 0; v < (NV); v++) {
          if (dist[v] == mav) continue;
          for (int i = 0; i < (((int)(E[v]).size())); i++) {
            edge &e = E[v][i];
            if (e.cap > 0 && dist[e.to] > dist[v] + e.cost + 1e-9) {
              dist[e.to] = dist[v] + e.cost;
              prev_v[e.to] = v;
              prev_e[e.to] = i;
              up = true;
            }
          }
        }
      }
      if (dist[to] == mav) return -1;
      int lc = flow;
      for (int v = to; v != from; v = prev_v[v])
        lc = min(lc, E[prev_v[v]][prev_e[v]].cap);
      flow -= lc;
      res += lc * dist[to];
      for (int v = to; v != from; v = prev_v[v]) {
        edge &e = E[prev_v[v]][prev_e[v]];
        e.cap -= lc;
        E[v][e.reve].cap += lc;
      }
    }
    return res;
  }
};
pair<int, int> P[410];
int N;
inline double dist(pair<int, int> p1, pair<int, int> p2) {
  return sqrt(pow(p1.first - p2.first, 2) + pow(p1.second - p2.second, 2));
}
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int N;
  cin >> N;
  for (int i = 0; i < (N); i++) {
    cin >> P[i].first >> P[i].second;
  }
  int max_y = P[0].second - 1;
  int max_cnt = 1;
  for (int i = 0; i < (N); i++) {
    if (max_y < P[i].second) {
      max_y = P[i].second;
      max_cnt = 1;
    } else if (max_y == P[i].second) {
      max_cnt += 1;
    }
  }
  if (max_cnt >= 2) {
    cout << -1 << "\n";
    return 0;
  }
  MinCostFlow<double> mcf;
  int start = 0;
  int goal = 950;
  for (int i = 0; i < (N); i++) {
    int in = i * 2 + 1;
    int out = i * 2 + 2;
    mcf.add_edge(start, out, 2, 0);
    mcf.add_edge(in, goal, 1, 0);
  }
  for (int i = 0; i < (N); i++) {
    for (int j = 0; j < (N); j++) {
      if (P[i].second > P[j].second) {
        double d = dist(P[i], P[j]);
        int i_out = i * 2 + 2;
        int j_in = j * 2 + 1;
        mcf.add_edge(i_out, j_in, 1, d);
      }
    }
  }
  auto ans = mcf.mincost(start, goal, N - 1);
  cout << fixed << setprecision(10) << ans << "\n";
  return 0;
}