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 JAVA):

Solution:
import java.io.*;
import java.util.*;
import java.math.*;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}
	final static double EPS = 1e-6;
	final static double INF = 1e7;
	int n;
	int[] match;
	boolean[] vx, vy;
	double[] lx, ly;
	double[][] mat;

	boolean find(int x) {
		vx[x] = true;
		for (int i = 1; i <= n + n; ++i)
			if (!vy[i] && Math.abs(lx[x] + ly[i] - mat[x][i]) < EPS) {
				vy[i] = true;
				int tmp = match[i];
				match[i] = x;
				if (tmp == 0 || find(tmp))
					return true;
				match[i] = tmp;
			}
		return false;
	}
	double dist(double x1, double y1, double x2, double y2) {
		return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
	}

	void run() {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(System.out);

		n = in.nextInt();
		int[] x = new int[n + 1], y = new int[n + 1];
		int maxy = -1001, tot = 0;
		for (int i = 1; i <= n; ++i) {
			x[i] = in.nextInt();
			y[i] = in.nextInt();
			maxy = Math.max(y[i], maxy);
		}
		for (int i = 1; i <= n; ++i)
			if (maxy == y[i])
				++tot;
		if (tot > 1) {
			out.println(-1);
			out.close();
			return;
		}
		mat = new double[n + n + 1][n + n + 1];
		for (int i = 1; i <= n; ++i)
			for (int j = 1; j <= n; ++j)
				if (y[i] == maxy) {
					mat[i][j] = 0;
					mat[i][j + n] = 0;
				}
				else if (y[i] < y[j]) {
					mat[i][j] = dist(x[i], y[i], x[j], y[j]);
					mat[i][j + n] = dist(x[i], y[i], x[j], y[j]);
				}
				else {
					mat[i][j] = INF;
					mat[i][j + n] = INF;
				}
		for (int i = 1; i <= n + n; ++i)
			for (int j = 1; j <= n + n; ++j)
				mat[i][j] = INF - mat[i][j];
		match = new int[n + n + 1];
		vx = new boolean[n + n + 1];
		vy = new boolean[n + n + 1];
		lx = new double[n + n + 1];
		ly = new double[n + n + 1];
		for (int i = 1; i <= n + n; ++i)
			for (int j = 1; j <= n + n; ++j)
				lx[i] = Math.max(lx[i], mat[i][j]);

		for (int i = 1; i <= n + n; ++i) {
			while (true) {
				Arrays.fill(vx, false);
				Arrays.fill(vy, false);
				if (find(i))
					break;
				double del = INF;
				for (int j = 1; j <= n + n; ++j)
					if (vx[j])
						for (int k = 1; k <= n + n; ++k)
							if (!vy[k])
								del = Math.min(del, lx[j] + ly[k] - mat[j][k]);
				for (int j = 1; j <= n + n; ++j) {
					if (vx[j])
						lx[j] -= del;
					if (vy[j])
						ly[j] += del;
				}
			}
		}

		double ret = 0;
		for (int i = 1; i <= n + n; ++i) {
			ret += lx[i] + ly[i];
		}

		if (2 * n * INF - ret > INF / 2)
			out.println(-1);
		else
			out.println(2 * n * INF - ret);

		out.close();
	}
}

class InputReader {
	BufferedReader buff;
	StringTokenizer tokenizer;

	InputReader(InputStream stream) {
		buff = new BufferedReader(new InputStreamReader(stream));
		tokenizer = null;
	}
	boolean hasNext() {
		while (tokenizer == null || !tokenizer.hasMoreTokens())
			try {
				tokenizer = new StringTokenizer(buff.readLine());
			}
			catch (Exception e) {
				return false;
			}
		return true;
	}
	String next() {
		if (!hasNext())
			throw new RuntimeException();
		return tokenizer.nextToken();
	}
	int nextInt() { return Integer.parseInt(next()); }
	long nextLong() { return Long.parseLong(next()); }
}