It was recycling day in Kekoland. To celebrate it Adil and Bera went to Central Perk where they can take bottles from the ground and put them into a recycling bin.

We can think Central Perk as coordinate plane. There are *n* bottles on the ground, the *i*-th bottle is located at position (*x*<sub class="lower-index">*i*</sub>, *y*<sub class="lower-index">*i*</sub>). Both Adil and Bera can carry only one bottle at once each. 

For both Adil and Bera the process looks as follows: 
 1.  Choose to stop or to continue to collect bottles. 1.  If the choice was to continue then choose some bottle and walk towards it. 1.  Pick this bottle and walk to the recycling bin. 1.  Go to step 1. 
Adil and Bera may move independently. They are allowed to pick bottles simultaneously, all bottles may be picked by any of the two, it's allowed that one of them stays still while the other one continues to pick bottles.

They want to organize the process such that the total distance they walk (the sum of distance walked by Adil and distance walked by Bera) is minimum possible. Of course, at the end all bottles should lie in the recycling bin.
First line of the input contains six integers *a*<sub class="lower-index">*x*</sub>, *a*<sub class="lower-index">*y*</sub>, *b*<sub class="lower-index">*x*</sub>, *b*<sub class="lower-index">*y*</sub>, *t*<sub class="lower-index">*x*</sub> and *t*<sub class="lower-index">*y*</sub> (0 ≤ *a*<sub class="lower-index">*x*</sub>, *a*<sub class="lower-index">*y*</sub>, *b*<sub class="lower-index">*x*</sub>, *b*<sub class="lower-index">*y*</sub>, *t*<sub class="lower-index">*x*</sub>, *t*<sub class="lower-index">*y*</sub> ≤ 10<sup class="upper-index">9</sup>) — initial positions of Adil, Bera and recycling bin respectively.

The second line contains a single integer *n* (1 ≤ *n* ≤ 100 000) — the number of bottles on the ground.

Then follow *n* lines, each of them contains two integers *x*<sub class="lower-index">*i*</sub> and *y*<sub class="lower-index">*i*</sub> (0 ≤ *x*<sub class="lower-index">*i*</sub>, *y*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">9</sup>) — position of the *i*-th bottle.

It's guaranteed that positions of Adil, Bera, recycling bin and all bottles are distinct.
Consider the first sample.

Adil will use the following path: <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/37eea809c04afe04f2670475cc5b21df4a90afd1.png" style="max-width: 100.0%;max-height: 100.0%;"/>.

Bera will use the following path: <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/08e917ff238fec015f897516a95529b6d9aed5c7.png" style="max-width: 100.0%;max-height: 100.0%;"/>.

Adil's path will be <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/f58aa00f71a0b723b5de3c8e56ce41dc8afec7f8.png" style="max-width: 100.0%;max-height: 100.0%;"/> units long, while Bera's path will be <img align="middle" class="tex-formula" src="https://espresso.codeforces.com/3615db76a2cdd77d711b73d2894f03bdd52af736.png" style="max-width: 100.0%;max-height: 100.0%;"/> units long.
3 1 1 2 0 0
3
1 1
2 1
2 3
11.084259940083
5 0 4 2 2 0
5
5 2
3 0
5 5
3 5
3 3
33.121375178000
107 50 116 37 104 118
12
16 78
95 113
112 84
5 88
54 85
112 80
19 98
25 14
48 76
95 70
77 94
38 32
1576.895607473206
446799 395535 281981 494983 755701 57488
20
770380 454998
147325 211816
818964 223521
408463 253399
49120 253709
478114 283776
909705 631953
303154 889956
126532 258846
597028 708070
147061 192478
39515 879057
911737 878857
26966 701951
616099 715301
998385 735514
277633 346417
642301 188888
617247 256225
668067 352814
22423982.398765542000
0 0 214409724 980408402 975413181 157577991
4
390610378 473484159
920351980 785918656
706277914 753279807
159291646 213569247
4854671149.842136400000
214409724 980408402 0 0 975413181 157577991
4
390610378 473484159
920351980 785918656
706277914 753279807
159291646 213569247
4854671149.842136400000
383677880 965754167 658001115 941943959 0 0
10
9412 5230
4896 7518
3635 6202
2365 1525
241 1398
7004 5166
1294 9162
3898 6706
6135 8199
4195 4410
1039303750.884648200000
825153337 326797826 774256604 103765336 0 0
21
6537 9734
3998 8433
560 7638
1937 2557
3487 244
8299 4519
73 9952
2858 3719
9267 5675
9584 7636
9234 1049
7415 6018
7653 9345
7752 9628
7476 8917
7207 2352
2602 4612
1971 3307
5530 3694
2393 8573
7506 9810
781520533.726828810000
214409724 980408402 975413181 157577991 0 0
4
3721 6099
5225 4247
940 340
8612 7341
988090959.937532070000
235810013 344493922 0 0 975204641 211157253
18
977686151 621301932
408277582 166435161
595105725 194278844
967498841 705149530
551735395 659209387
492239556 317614998
741520864 843275770
585383143 903832112
272581169 285871890
339100580 134101148
920610054 824829107
657996186 852771589
948065129 573712142
615254670 698346010
365251531 883011553
304877602 625498272
418150850 280945187
731399551 643859052
20756961047.556908000000
0 0 1 1 2 2
1
1 3
3.414213562373
10000 1000 151 121 10 10
2
1 1
2 2
227.449066182313
5 5 10 10 15 15
2
1 1
11 11
32.526911934581
1000000 1000000 1 1 0 0
1
2 2
4.242640687119
100 0 0 1 0 0
2
1 1
1 2
6.478708664619
0 0 1000000000 1000000000 1 1
2
0 1
1 0
4.000000000000
1000 1000 0 0 1 1
1
2 2
4.242640687119
1 0 1000000 0 0 0
2
1 1
2 2
7.892922226992
3 0 100 100 0 0
2
1 0
2 0
5.000000000000
0 100 0 101 0 0
1
0 99
100.000000000000
1000 1000 3 3 0 0
2
1 0
0 1
6.605551275464
0 5 0 6 0 7
1
0 100
187.000000000000
1 1 1000000 1000000 0 0
2
1 2
2 1
7.708203932499
1 0 10000000 1000000 0 0
2
1 1
2 2
7.892922226992
2 2 10 2 6 5
2
6 2
5 5
9.000000000000
100000001 100000001 100000000 100000000 1 1
1
1 0
141421356.530202720000
1000 1000 1001 1001 0 0
2
1 1
2 2
1417.041989497841
1000000000 1000000000 999999999 999999999 1 1
4
1 2
1 3
2 2
2 3
1414213568.487842800000
0 100 1 1 1 0
2
2 1
0 1
5.242640687119
0 100 0 1 0 0
5
0 2
0 3
0 4
0 5
0 6
39.000000000000
100 0 0 100 0 0
2
0 1
1 0
102.000000000000
0 0 1000000 1000000 0 1
2
1 1
2 2
6.886349517373
0 0 1000 1000 1 0
2
1 1
1 2
6.236067977500
1 0 100000 100000 0 0
1
2 0
3.000000000000
5 5 5 4 4 5
2
3 4
3 5
5.414213562373
10000 10000 9000 9000 0 0
3
1 1
2 2
3 3
12736.407342732093
1 1 1000 1000 0 0
3
2 2
3 3
4 4
24.041630560343
7 0 8 0 0 0
2
1 0
1 1
9.496976092671
1 3 3 3 2 1
2
2 3
3 1
5.000000000000
1 2 3 4 5 6
1
1 1
7.403124237433
1000000000 1000000000 0 0 1 1
5
2 2
2 3
2 4
2 5
2 6
33.294904485247
2 1 1 2 0 0
1
1 1
2.414213562373
1 0 100000 0 0 0
2
1 1
2 2
7.892922226992
0 100 1 100 1 0
2
2 1
0 1
103.242640687119
0 0 2 0 1 5
2
1 0
1 20
36.000000000000
1000 1000 999 999 0 0
2
1 0
0 1
1415.092419071783
5 0 1000 1000 2 0
2
4 0
6 7
19.124515496597
10000 0 1000000 0 0 0
2
1 1
2 2
10003.657054289499
0 100 0 101 0 0
2
0 1
0 2
102.000000000000
0 0 10000 10000 1 0
2
2 0
3 0
7.000000000000
3 1 1 2 0 0
1
1 1
2.414213562373
1000 0 0 1000 0 0
2
1 0
0 1
1002.000000000000
1 1 1000000 1000000 0 0
2
2 1
1 2
7.708203932499
1000 1000 2000 2000 1 1
3
2 2
1 2
3 3
1417.627775935468
0 0 1000000000 1000000000 1 1
4
2 2
3 3
4 4
5 5
29.698484809835
10000000 1 2 1 1 1
3
1 3
1 4
1 5
18.123105625618
3 7 5 7 4 4
2
4 6
4 0
11.414213562373
0 0 3 0 1 5
2
1 0
1 20
36.000000000000
0 0 0 1 1000 3
2
1000 2
1000 1
1004.000000000000
1000000000 0 0 1 0 0
2
0 2
0 3
9.000000000000
0 1000000000 1000000000 0 0 0
1
1 1
1000000000.414213500000
1000 1000 1000 1001 0 0
2
0 1
1 1
1416.213562373095
1002 0 1001 0 0 0
1
1000 0
1001.000000000000
1002 0 1001 0 0 0
2
2 0
1 0
1003.000000000000
3 0 0 100 0 0
2
1 0
2 0
5.000000000000
10 10 0 0 0 1
2
1 0
1 1
4.414213562373
1000 1000 1001 1001 0 0
2
0 1
1 1
1416.213562373095
0 100 0 200 0 0
2
0 1
0 2
102.000000000000
100 100 0 0 1 1
1
2 2
4.242640687119
123123 154345 123123 123123 2 2
3
3 3
4 4
5 5
174127.873294312070
0 1 0 2 0 0
1
1 0
2.414213562373
1 2 3 4 1000 1000
1
156 608
1553.668251715911
0 0 10 0 5 0
3
4 1
5 1
6 1
10.365746312737
0 0 0 1 1000000000 999999999
1
1000000000 1000000000
1414213562.665988200000
1231231 2342342 123124 123151 12315 12312
1
354345 234234
664238.053973730540
0 0 1000000 0 1 1
2
0 1
3 0
6.472135955000
1000 1000 2000 2000 1 1
1
2 2
1412.799348810722
10 20 10 0 10 10
2
10 11
10 9
12.000000000000
1000000000 1 1 1000000000 0 0
1
2 2
1000000000.828427200000
0 0 1000 1000 1 0
2
2 0
3 0
7.000000000000
1000 0 100000000 100000000 0 0
2
999 0
1100 0
3198.000000000000
2 2 1000000000 1000000000 0 0
3
1 1
5 5
100 100
296.984848098350
2 0 4 0 0 0
1
3 0
4.000000000000
2 2 1000 1000 0 0
2
1 1
1 2
6.064495102246
0 0 1000000000 1000000000 0 1
3
1 0
2 0
3 0
13.210904837709
1 10000 10000 1 0 0
2
1 100
100 1
10200.014999625020
5 0 6 0 0 0
2
2 0
0 2
9.000000000000
2 4 1000000000 1000000000 0 0
4
2 3
2 1
3 2
1 2
20.760925736391
0 100 1 1 0 0
2
0 1
3 1
7.162277660168
0 0 10 0 8 2
1
6 0
6.828427124746
0 9 0 8 0 1
1
0 0
9.000000000000
100 0 0 100 0 0
2
40 0
0 40
180.000000000000
0 0 0 1 1000 3
2
1000 1
1000 2
1004.000000000000
1 1 123123 123123 2 2
3
3 3
4 4
5 5
18.384776310850
999999999 999999999 1000000000 1000000000 1 1
1
1 0
1414213561.251774800000
3 2 1 1 0 0
1
2 2
3.828427124746
0 0 1 1 100 100
2
101 101
102 102
148.492424049175
1 15 4 10 1 1
2
1 10
4 5
22.000000000000
100 0 0 100 0 0
2
60 0
0 40
180.000000000000
0 0 0 1000 1 0
4
0 1
0 2
0 3
0 4
21.457116088945
0 0 100 0 3 0
1
2 0
3.000000000000
0 0 100 0 98 2
1
98 0
4.000000000000
1 1 2 2 3 3
1
0 0
5.656854249492
2 2 1 1 0 0
1
1 2
3.236067977500
10000000 1 2 1 1 1
3
1 40
1 20
1 5
124.012818406262
1000 1000 1001 1000 0 0
3
1 1
1 2
1 3
1421.848684511914
10000 10000 9999 9999 0 0
3
0 1
0 2
0 3
14147.600248963827
from math import *

ax, ay, bx, by, cx, cy = [int(t) for t in input().split()]
n = int(input())
dist = 0
maxv = [[-inf, -inf], [-inf, -inf]]
index = [[0,0], [0,0]]

def update(d, idx, p):
    global maxv, index
    if d > maxv[p][0]:
        maxv[p][1] = maxv[p][0]
        index[p][1] = index[p][0]
        maxv[p][0] = d
        index[p][0] = idx
    elif d > maxv[p][1]:
        maxv[p][1] = d
        index[p][1] = idx

for i in range(n):
    x, y = [int(t) for t in input().split()]
    bottle_recycle = sqrt((cx - x) ** 2 + (cy - y) ** 2)
    dist += bottle_recycle * 2
    dista = bottle_recycle - sqrt((ax - x) ** 2 + (ay - y) ** 2)
    distb = bottle_recycle - sqrt((bx - x) ** 2 + (by - y) ** 2)
    update(dista, i, 0)
    update(distb, i, 1)

ans = dist - maxv[0][0]
ans = min(ans, dist - maxv[1][0])
if(index[0][0] != index[1][0]):
    ans = min(ans, dist - maxv[0][0] - maxv[1][0])
elif(n > 1):
    ans = min(ans, dist - maxv[0][1] - maxv[1][0], dist - maxv[0][0] - maxv[1][1])
print(ans)