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.
The first line of the input file contains the handbag's coordinates *x*<sub class="lower-index">*s*</sub>, *y*<sub class="lower-index">*s*</sub>. 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.
none
0 0
2
1 1
-1 1
8
0 1 2 0 
1 1
3
4 3
3 4
0 0
32
0 1 2 0 3 0 
-3 4
1
2 2
58
0 1 0 
7 -7
2
3 1
-3 8
490
0 1 2 0 
3 -9
3
0 -9
-10 -3
-12 -2
502
0 1 0 2 3 0 
4 -1
4
14 -3
-11 10
-3 -5
-8 1
922
0 1 0 2 4 0 3 0 
7 -11
5
-1 7
-7 -11
12 -4
8 -6
-18 -8
1764
0 1 3 0 2 5 0 4 0 
11 3
6
-17 -17
-4 -9
15 19
7 4
13 1
5 -6
2584
0 1 2 0 3 0 4 6 0 5 0 
-6 4
7
-10 -11
-11 -3
13 27
12 -22
19 -17
21 -21
-5 4
6178
0 1 4 0 2 0 3 7 0 5 6 0 
27 -5
8
-13 -19
-20 -8
11 2
-23 21
-28 1
11 -12
6 29
22 -15
14062
0 1 2 0 3 7 0 4 5 0 6 8 0 
31 9
9
8 -26
26 4
3 2
24 21
14 34
-3 26
35 -25
5 20
-1 8
9384
0 1 7 0 2 0 3 9 0 4 5 0 6 8 0 
-44 47
24
96 -18
-50 86
84 68
-25 80
-11 -15
-62 0
-42 50
-57 11
-5 27
-44 67
-77 -3
-27 -46
32 63
86 13
-21 -51
-25 -62
-14 -2
-21 86
-92 -94
-44 -34
-74 55
91 -35
-10 55
-34 16
191534
0 1 22 0 2 10 0 3 14 0 4 18 0 5 20 0 6 11 0 7 0 8 24 0 9 17 0 12 15 0 13 23 0 16 19 0 21 0 
5 4
11
-26 2
20 35
-41 39
31 -15
-2 -44
16 -28
17 -6
0 7
-29 -35
-17 12
42 29
19400
0 1 3 0 2 11 0 4 6 0 5 9 0 7 0 8 10 0 
-44 22
12
-28 24
41 -19
-39 -36
12 -18
-31 -24
-7 29
45 0
12 -2
42 31
28 -37
-34 -38
6 24
59712
0 1 5 0 2 10 0 3 11 0 4 8 0 6 12 0 7 9 0 
40 -36
13
3 -31
28 -43
45 11
47 -37
47 -28
-30 24
-46 -33
-31 46
-2 -38
-43 -4
39 11
45 -1
50 38
52988
0 1 9 0 2 0 3 13 0 4 5 0 6 8 0 7 10 0 11 12 0 
-54 2
14
-21 -2
-5 34
48 -55
-32 -23
22 -10
-33 54
-16 32
-53 -17
10 31
-47 21
-52 49
34 42
-42 -25
-32 31
55146
0 1 4 0 2 7 0 3 5 0 6 11 0 8 13 0 9 12 0 10 14 0 
-19 -31
15
-31 -59
60 -34
-22 -59
5 44
26 39
-39 -23
-60 -7
1 2
-5 -19
-41 -26
46 -8
51 -2
60 4
-12 44
14 49
60546
0 1 3 0 2 11 0 4 14 0 5 15 0 6 0 7 10 0 8 9 0 12 13 0 
-34 19
16
-44 24
30 -42
46 5
13 -32
40 53
35 49
-30 7
-60 -50
37 46
-18 -57
37 -44
-61 58
13 -55
28 22
-50 -3
5 52
81108
0 1 12 0 2 11 0 3 14 0 4 13 0 5 9 0 6 16 0 7 15 0 8 10 0 
-64 -6
17
-3 -18
66 -58
55 34
-4 -40
-1 -50
13 -9
56 55
3 42
-54 -52
51 -56
21 -27
62 -17
54 -5
-28 -24
12 68
43 -22
8 -6
171198
0 1 14 0 2 10 0 3 7 0 4 5 0 6 17 0 8 15 0 9 0 11 16 0 12 13 0 
7 -35
18
24 -3
25 -42
-56 0
63 -30
18 -63
-30 -20
-53 -47
-11 -17
-22 -54
7 -41
-32 -3
-29 15
-30 -25
68 15
-18 70
-28 19
-12 69
44 29
70504
0 1 4 0 2 5 0 3 11 0 6 13 0 7 9 0 8 0 10 0 12 16 0 14 18 0 15 17 0 
-8 47
19
47 51
43 -57
-76 -26
-23 51
19 74
-36 65
50 4
48 8
14 -67
23 44
5 59
7 -45
-52 -6
-2 -33
34 -72
-51 -47
-42 4
-41 55
22 9
112710
0 1 10 0 2 15 0 3 16 0 4 0 5 11 0 6 18 0 7 8 0 9 12 0 13 17 0 14 19 0 
44 75
20
-19 -33
-25 -42
-30 -61
-21 44
7 4
-38 -78
-14 9
65 40
-27 25
65 -1
-71 -38
-52 57
-41 -50
-52 40
40 44
-19 51
42 -43
-79 -69
26 -69
-56 44
288596
0 1 19 0 2 13 0 3 6 0 4 16 0 5 7 0 8 15 0 9 14 0 10 17 0 11 18 0 12 20 0 
42 -34
21
4 62
43 73
29 -26
68 83
0 52
-72 34
-48 44
64 41
83 -12
-25 52
42 59
1 38
12 -79
-56 -62
-8 67
84 -83
22 -63
-11 -56
71 44
7 55
-62 65
196482
0 1 15 0 2 4 0 3 0 5 12 0 6 21 0 7 10 0 8 19 0 9 16 0 11 20 0 13 17 0 14 18 0 
-44 42
22
-67 -15
74 -14
67 76
-57 58
-64 78
29 33
-27 27
-20 -52
-54 -2
-29 22
31 -65
-76 -76
-29 -51
-5 -79
-55 36
72 36
-80 -26
5 60
-26 69
78 42
-47 -84
8 83
181122
0 1 17 0 2 16 0 3 20 0 4 5 0 6 18 0 7 10 0 8 13 0 9 15 0 11 14 0 12 21 0 19 22 0 
52 92
23
-67 -82
31 82
-31 -14
-1 35
-31 -49
-75 -14
78 -51
-35 -24
28 -84
44 -51
-37 -9
-38 -91
41 57
-19 35
14 -88
-60 -60
-13 -91
65 -8
-30 -46
72 -44
74 -5
-79 31
-3 84
492344
0 1 12 0 2 23 0 3 11 0 4 14 0 5 16 0 6 22 0 7 20 0 8 19 0 9 10 0 13 0 15 17 0 18 21 0 
-21 -47
24
-37 1
-65 8
-74 74
58 -7
81 -31
-77 90
-51 10
-42 -37
-14 -17
-26 -71
62 45
56 43
-75 -73
-33 68
39 10
-65 -93
61 -93
30 69
-28 -53
5 24
93 38
-45 -14
3 -86
63 -80
204138
0 1 22 0 2 7 0 3 6 0 4 5 0 8 19 0 9 20 0 10 23 0 11 21 0 12 15 0 13 16 0 14 18 0 17 24 0 
31 16
21
-9 24
-59 9
-25 51
62 52
39 15
83 -24
45 -81
42 -62
57 -56
-7 -3
54 47
-14 -54
-14 -34
-19 -60
-38 58
68 -63
-1 -49
6 75
-27 22
-58 -77
-10 56
121890
0 1 10 0 2 19 0 3 15 0 4 11 0 5 0 6 16 0 7 9 0 8 17 0 12 13 0 14 20 0 18 21 0 
20 -1
22
-51 -31
-41 24
-19 46
70 -54
60 5
-41 35
73 -6
-31 0
-29 23
85 9
-7 -86
8 65
-86 66
-35 14
11 19
-66 -34
-36 61
84 -10
-58 -74
-11 -67
79 74
3 -67
135950
0 1 16 0 2 6 0 3 12 0 4 18 0 5 7 0 8 14 0 9 15 0 10 21 0 11 22 0 13 17 0 19 20 0 
-49 4
23
-18 -53
-42 31
18 -84
-20 -70
-12 74
-72 81
12 26
3 9
-70 -27
34 -32
74 -47
-19 -35
-46 -8
-77 90
7 -42
81 25
84 81
-53 -49
20 81
-39 0
-70 -44
-63 77
-67 -73
169524
0 1 4 0 2 22 0 3 15 0 5 19 0 6 14 0 7 8 0 9 21 0 10 11 0 12 13 0 16 17 0 18 23 0 20 0 
-81 35
24
58 27
92 -93
-82 63
-55 80
20 67
33 93
-29 46
-71 -51
-19 8
58 -71
13 60
0 -48
-2 -68
-56 53
62 52
64 32
-12 -63
-82 -22
9 -43
55 12
77 -21
26 -25
-91 -32
-66 57
337256
0 1 16 0 2 10 0 3 24 0 4 14 0 5 11 0 6 15 0 7 9 0 8 17 0 12 13 0 18 23 0 19 22 0 20 21 0 
45 79
24
-66 22
10 77
74 88
59 1
-51 -86
-60 91
1 -51
-23 85
3 96
38 -4
-55 43
9 -68
-4 83
75 -13
64 -74
28 27
92 -57
-20 -64
30 -44
-95 67
13 55
67 -4
42 77
61 87
277576
0 1 11 0 2 9 0 3 24 0 4 16 0 5 18 0 6 20 0 7 12 0 8 13 0 10 19 0 14 22 0 15 17 0 21 23 0 
-61 34
24
-57 -46
-37 -24
-87 -54
51 -89
-90 2
95 -63
-24 -84
-85 38
-52 -62
96 4
89 -22
-16 -3
-2 -14
71 -62
-51 68
-83 -24
15 77
-61 45
17 -32
-68 -87
-93 -28
-85 24
-84 -34
-4 1
262400
0 1 9 0 2 12 0 3 23 0 4 19 0 5 22 0 6 14 0 7 20 0 8 18 0 10 11 0 13 24 0 15 17 0 16 21 0 
70 90
24
-64 -96
-87 -82
10 -65
94 22
95 60
-13 54
-83 -92
95 -50
-65 -91
96 -88
80 -56
-31 85
58 86
-28 22
-22 45
-24 -12
-62 70
-2 -77
-31 -72
61 37
67 43
-5 -30
-84 -59
-91 51
585696
0 1 7 0 2 23 0 3 18 0 4 8 0 5 0 6 12 0 9 19 0 10 11 0 13 0 14 15 0 16 22 0 17 24 0 20 21 0 
72 -37
24
56 -47
-37 -20
76 -46
-14 11
-63 -46
52 74
-60 -23
27 8
-78 -26
15 -23
74 -90
39 -64
86 53
77 11
-47 -44
-1 -14
90 56
76 -88
-27 51
-67 -8
-27 4
83 -91
54 68
56 26
224008
0 1 3 0 2 7 0 4 19 0 5 15 0 6 23 0 8 10 0 9 20 0 11 12 0 13 17 0 14 24 0 16 21 0 18 22 0 
9 -5
10
-22 23
22 -26
10 -32
18 -34
7 -27
2 -38
-5 -24
-38 -15
21 -32
-17 37
13454
0 1 10 0 2 9 0 3 4 0 5 6 0 7 8 0 
#!/usr/bin/env python
'''
' Author:   Cheng-Shih Wong
' Email:    [email protected]
' Date:     2017-08-08
'''

from itertools import chain
from time import time

def main():

    BITS = [1 << sh for sh in range(24)]
    B2N = {v: u for u, v in enumerate(BITS)}

    def getPt():
        return tuple(map(int, input().split()))

    def dist(ptA, ptB):
        return sum(((u-v)**2 for u, v in zip(ptA, ptB)))

    def getBits(val):
        return tuple(filter(lambda x: x&val, BITS))

    def chooseTwo(pool):
        n = len(pool)
        for i in range(n):
            for j in range(i+1, n):
                yield (pool[i], pool[j])

    ori = getPt()
    pts = []
    N = int(input())

    for _ in range(N):
        pts.append(getPt())

    vis = set([0])
    mint = [0]+[1e8]*(1<<N) # minimal time for dp
    pres = [None]*(1<<N) # previous step for reconstruct path
    allb = (1 << N)-1 # all objects contained state
    B2P = {BITS[u]: v for u, v in enumerate(pts)}
    B2P[0] = ori
    alld = {u: {v: dist(B2P[u], B2P[v]) for v in B2P} for u in B2P}

    getDP = lambda x: mint[x]
    newDist = lambda stt, p: mint[stt] + alld[p[0]][p[1]] \
                                + alld[p[0]][0] \
                                + alld[p[1]][0] 

    for stt in range(1<<N):
        if stt not in vis:
            continue

        bits = getBits(~stt&allb)

        sb = bits[0] if bits else None

        for bit in bits:

            newstt = stt | sb | bit
            nd = newDist(stt, (sb, bit))
            if getDP(newstt) > nd:
                mint[newstt] = nd
                pres[newstt] = sb | bit
                vis.add(newstt)

    print(mint[allb])
    path = ['0']
    stt = allb

    while stt:

        bits = getBits(pres[stt])
        for bit in bits:
            path.append(str(B2N[bit]+1))
        path.append('0')

        stt ^= pres[stt]

    print(' '.join(path))

if __name__ == '__main__':
    import sys
    st = time()
    main()
    print('Run {:.6f} seconds.'.format(time()-st), file=sys.stderr)
