Problem: Girl Lena likes it when everything is in order, and looks for order everywhere. Once she was getting ready for the University and noticed that the room was in a mess — all the objects from her handbag were thrown about the room. Of course, she wanted to put them back into her handbag. The problem is that the girl cannot carry more than two objects at a time, and cannot move the handbag. Also, if he has taken an object, she cannot put it anywhere except her handbag — her inherent sense of order does not let her do so.

You are given the coordinates of the handbag and the coordinates of the objects in some Сartesian coordinate system. It is known that the girl covers the distance between any two objects in the time equal to the squared length of the segment between the points of the objects. It is also known that initially the coordinates of the girl and the handbag are the same. You are asked to find such an order of actions, that the girl can put all the objects back into her handbag in a minimum time period.

Input

The first line of the input file contains the handbag's coordinates xs, ys. The second line contains number n (1 ≤ n ≤ 24) — the amount of objects the girl has. The following n lines contain the objects' coordinates. All the coordinates do not exceed 100 in absolute value. All the given positions are different. All the numbers are integer.

Output

In the first line output the only number — the minimum time the girl needs to put the objects into her handbag. 

In the second line output the possible optimum way for Lena. Each object in the input is described by its index number (from 1 to n), the handbag's point is described by number 0. The path should start and end in the handbag's point. If there are several optimal paths, print any of them. 

Examples

Input

0 0
2
1 1
-1 1


Output

8
0 1 2 0 


Input

1 1
3
4 3
3 4
0 0


Output

32
0 1 2 0 3 0 

Solution (in JAVA):

Solution:
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
		TaskB solver = new TaskB();
		solver.solve(1, in, out);
		out.flush();
		out.close();
	}
}

class Pair implements Comparable<Pair> {
	int first;
	int second;

	Pair(int first, int second) {
		this.first = first;
		this.second = second;
	}

	@Override
	public int compareTo(Pair e) {
		return Long.compare(second, e.second);

	}
}

class TaskB {
	int INF = (int) 1e9 + 7;
	int MAX_N = (int) 1e5 + 5;
	long mod = (long) 1e8;

	void solve(int testNumber, InputReader in, PrintWriter pw) {
		int x0 = in.nextInt();
		int y0 = in.nextInt();
		int n = in.nextInt();
		int p[][] = new int[n + 1][];
		p[0] = new int[] { x0, y0 };
		for (int i = 1; i <= n; i++) {
			p[i] = new int[] { in.nextInt(), in.nextInt() };
		}
		int dp[] = new int[1 << n];
		// dp[mask] stores the minimum cost to pickup mask items
		int prev[] = new int[1 << n];
		int two[][] = new int[n][n];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				two[i][j] = dist(p[i + 1], p[j + 1]) + dist(p[i + 1], p[0]) + dist(p[j + 1], p[0]);
//				pw.println(i + " " + j + " " + two[i][j]);
			}
		}
		Arrays.fill(dp, INF);
		dp[0] = 0;
		for (int i = 0; i < (1 << n); i++) {
			for (int j = 0; j < n; j++) {
				if (((i >> j) & 1) != 0) {
					continue;
				}
				int mask = i | (1 << j);
				int cost = dp[i] + two[j][j];

				if (cost < dp[mask]) {
					dp[mask] = cost;
					prev[mask] = j;
				}
				for (int k = j + 1; k < n; k++) {
					if (((mask >> k) & 1) != 0) {
						continue;
					}
					int nmask = mask | (1 << k);
					int ncost = dp[i] + two[j][k];
					if (ncost < dp[nmask]) {
						dp[nmask] = ncost;
						prev[nmask] = n + n * j + k;
						// trick to store the two pairs
					}
				}
				break;
			}
		}
		int temp = (1 << n) - 1;
		ArrayList<Integer> ans = new ArrayList<>();
		pw.println(dp[temp]);
		ans.add(0);
		while (temp > 0) {
			int mov = prev[temp];
			if (mov < n) {
				int rem = (1 << prev[temp]);
				temp ^= rem;
				ans.add(mov + 1);
			} else {
				int first = prev[temp] / n - 1;
				int second = prev[temp] % n;
				int rem = (1 << first);
				int rem2 = (1 << second);
				temp ^= rem;
				temp ^= rem2;
				ans.add(first + 1);
				ans.add(second + 1);
			}
			ans.add(0);
		}
		Collections.reverse(ans);
		for (int x : ans) {
			pw.print(x + " ");
		}
	}

	int dist(int[] x, int[] y) {
		return (x[0] - y[0]) * (x[0] - y[0]) + (x[1] - y[1]) * (x[1] - y[1]);

	}

	long gcd(long a, long b) {
		if (b == 0) {
			return a;
		} else {
			return gcd(b, a % b);
		}
	}

	int[] shrink(int a[]) {
		int n = a.length;
		long b[] = new long[n];
		for (int i = 0; i < n; i++) {
			b[i] = ((long) (a[i] << 32)) | i;
		}
		Arrays.sort(b);
		int ret[] = new int[n];
		int p = 0;
		for (int i = 0; i < n; i++) {
			if (i > 0 && (b[i] ^ b[i - 1]) >> 32 != 0) {
				p++;
			}
			ret[(int) b[i]] = p;
		}
		return ret;
	}

	int sum(int ft[], int i) {
		int sum = 0;
		for (int j = i; j >= 1; j -= (j & -j)) {
			sum += ft[j];
//			System.out.println(sum);
		}
		return sum;
	}

	void add(int ft[], int i, int x) {
		for (int j = i; j < ft.length; j += (j & -j)) {
//			System.out.println(j);
			ft[j] += x;
		}
	}

	boolean isValid(int i, int j, char arr[][]) {

		if (i >= arr[0].length || j >= arr[0].length) {
			return false;
		}
		if (arr[i][j] == '*') {
			return false;
		}
		return true;
	}

	long pow(long m, long k) {
		long prod = 1;
		for (int i = 0; i < k; i++) {
			prod = (prod * m) % INF;
		}
		return prod % INF;
	}

//	int sum(int k) {
//		int sum=0;
//		for(int i=k;i>=1;i) {
//			sum+=ft[k];
//		}
//	}

	long fib(int N) {
		long fib[] = new long[N + 1];
		fib[0] = 1;
		fib[1] = 1;
		for (int i = 2; i <= N; i++) {
			fib[i] = (fib[i - 1] + fib[i - 2]) % mod;
		}
		return fib[N] % mod;
	}

	long sum(int i, int j, long arr[]) {
		long sum = 0;
		for (int k = i; k <= j; k++) {
			sum += arr[k];
		}
		return sum;
	}

	int __gcd(int a, int b) {
		if (b == 0)
			return a;
		return __gcd(b, a % b);

	}

	public int isPow(long num) {
		int count = 0;
		while (num > 0) {
			num /= 2;
			count++;
		}
		return count;
	}
}

class InputReader {
	BufferedReader br;
	StringTokenizer st;

	public InputReader(InputStream in) {
		br = new BufferedReader(new InputStreamReader(in));
		st = null;
	}

	public String next() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return st.nextToken();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}