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:

// Problem: C. Looking for Order
// Contest: Codeforces - Codeforces Beta Round #8
// URL: https://codeforces.com/contest/8/problem/C
// Memory Limit: 512 MB
// Time Limit: 4000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

import java.io.*;
import java.util.*;

public class Main {
    private static PrintWriter pw = new PrintWriter(System.out);
    private static InputReader sc = new InputReader(System.in);
    private static final int intmax = Integer.MAX_VALUE;
    
    static class InputReader {
        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar, snumChars;
        private SpaceCharFilter filter;
 
        InputReader(InputStream stream) {
            this.stream = stream;
        }
 
        int snext() {
            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }
 
        int nextInt() {
            int c = snext();
            while (isSpaceChar(c)) {
                c = snext();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = snext();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = snext();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
 
        boolean isSpaceChar(int c) {
            if (filter != null)
                return filter.isSpaceChar(c);
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
 
        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }
 
        public interface SpaceCharFilter {
            boolean isSpaceChar(int ch);
        }
    }

    public static void main(String args[])throws IOException{
        int t = 1;
        while(t-->0)    solve();
        pw.flush();
        pw.close();
    }
    
    private static int points[][];
    
    private static int cal(int point[]){
    	return point[0]*point[0] + point[1]*point[1];
    }
    
    private static int dist(int point1[], int point2[]){
    	return cal(point1) + cal(point2) + cal(new int[]{point1[0] - point2[0], point1[1] - point2[1]});
    }

    private static void solve()throws IOException{
		int ox = sc.nextInt(), oy = sc.nextInt(), n = sc.nextInt();
		
		points = new int[n][2];
		
		for(int i = 0; i < n; i++)
			points[i] = new int[]{sc.nextInt() - ox, sc.nextInt() - oy};
		
		int dp[] = new int[1<<n], prev[] = new int[1<<n];
		
		for(int mask = 1; mask < (1<<n); mask++){
			dp[mask] = intmax;
			
			for(int bit = 0; bit < n; bit++){
				if((mask & (1<<bit)) > 0){
					
					int child = mask^(1<<bit), tmp = cal(points[bit])*2 + dp[child];
					
					if(dp[mask] > tmp){
						dp[mask] = tmp;
						prev[mask] = bit;
					}
					
					for(int bit2 = bit + 1; bit2 < n; bit2++){
						
						if((child & (1<<bit2)) > 0){
							int child2 = child^(1<<bit2);
							
							tmp = dp[child2] + dist(points[bit], points[bit2]);
							
							if(dp[mask] > tmp){
								dp[mask] = tmp;
								prev[mask] = n + n * bit + bit2;
							}
						}
					}
					
					break;
				}
			}
		}
		
		pw.println(dp[(1<<n) - 1]);
		
		int mask = (1<<n) - 1;
		
		while(mask > 0){
			pw.print(0+" ");
			
			if(prev[mask] > n){
				int first = (prev[mask])/n - 1, second = prev[mask]%n;
				
				pw.print(+(first + 1)+" "+(second + 1)+" ");
				
				mask ^= (1<<first) ^ (1<<second);
			}else{
				pw.print(+(prev[mask] + 1)+" ");
				
				mask ^= (1<<prev[mask]);
			}
		}
		
		pw.println(0);
    }
}