import os,io
from sys import stdout
import collections
# import random
# import math
# from operator import itemgetter
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
# from collections import Counter
# from decimal import Decimal
# import heapq
# from functools import lru_cache

import sys
# import threading
# sys.setrecursionlimit(10**6)
# threading.stack_size(102400000)

# from functools import lru_cache
# @lru_cache(maxsize=None)

######################
# --- Maths Fns  --- #
######################
def primes(n):
    sieve = [True] * n
    for i in range(3,int(n**0.5)+1,2):
        if sieve[i]:
            sieve[i*i::2*i]=[False]*((n-i*i-1)//(2*i)+1)
    return [2] + [i for i in range(3,n,2) if sieve[i]]

def binomial_coefficient(n, k):
    if 0 <= k <= n:
        ntok = 1
        ktok = 1
        for t in range(1, min(k, n - k) + 1):
            ntok *= n
            ktok *= t
            n -= 1
        return ntok // ktok
    else:
        return 0

def powerOfK(k, max):
    if k == 1:
        return [1]
    if k == -1:
        return [-1, 1]

    result = []
    n = 1
    while n <= max:
        result.append(n)
        n *= k
    return result

def divisors(n):
    i = 1
    result = []
    while i*i <= n:
        if n%i == 0:
            if n/i == i:
                result.append(i)
            else:
                result.append(i)
                result.append(n/i)
        i+=1
    return result

# @lru_cache(maxsize=None)
def digitsSum(n):
    if n == 0:
        return 0
    r = 0
    while n > 0:
        r += n % 10
        n //= 10
    return r

######################
# ---- GRID Fns ---- #
######################
def isValid(i, j, n, m):
    return i >= 0 and i < n and j >= 0 and j < m

def print_grid(grid):
    for line in grid:
        print(" ".join(map(str,line)))

######################
# ---- MISC Fns ---- #
######################
def kadane(a,size):
    max_so_far = 0
    max_ending_here = 0

    for i in range(0, size):
        max_ending_here = max_ending_here + a[i]
        if (max_so_far < max_ending_here):
            max_so_far = max_ending_here

        if max_ending_here < 0:
            max_ending_here = 0
    return max_so_far

def prefixSum(arr):
    for i in range(1, len(arr)):
        arr[i] = arr[i] + arr[i-1]
    return arr

def ceil(n, d):
    if n % d == 0:
        return n // d
    else:
        return (n // d) + 1

# INPUTS  --------------------------
# s = input().decode('utf-8').strip()
# n = int(input())
# l = list(map(int, input().split()))
# t = int(input())
# for _ in range(t):
# for _ in range(t):

def distance(xa, ya, xb, yb):
    return ((ya-yb)**2 + (xa-xb)**2)**(0.5)

xa, ya, xb, yb, xt, yt = list(map(int, input().split()))
n = int(input())

import math
bottles = []
ans = 0
ra, rb = [], []
for _ in range(n):
    xbt, ybt = list(map(int, input().split()))
    bottles.append((xbt, ybt))
    da = distance(xa, ya, xbt, ybt)
    db = distance(xb, yb, xbt, ybt)
    dt = distance(xt, yt, xbt, ybt)
    ra.append((da-dt, xbt, ybt, dt))
    rb.append((db-dt, xbt, ybt, dt))
    ans += 2*dt

ra = sorted(ra, key=lambda x: x[0])
rb = sorted(rb, key=lambda x: x[0])

# for e in ra:
#     print(e)
# print()
# for e in rb:
#     print(e)

if n == 1:
    print(ans+min(ra[0][0], rb[0][0]))
    exit()

a0 = ra[0]
a1 = ra[1]
b0 = rb[0]
b1 = rb[1]
if a0[0] <= 0 and b0[0] <= 0:
    if a0[1] == b0[1] and a0[2] == b0[2]:
        r = min(a0[0]+b1[0], b0[0]+a1[0])
        r = min(r, a0[0])
        r = min(r, b0[0])
        print(ans + r)
        exit()
    else:
        print(ans + a0[0] + b0[0])
        exit()
else:
    print(ans + min(a0[0], b0[0]))


import os,io
from sys import stdout
import collections
# import random
# import math
# from operator import itemgetter
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
# from collections import Counter
# from decimal import Decimal
# import heapq
# from functools import lru_cache

import sys
# import threading
# sys.setrecursionlimit(10**6)
# threading.stack_size(102400000)

# from functools import lru_cache
# @lru_cache(maxsize=None)

######################
# --- Maths Fns  --- #
######################
def primes(n):
    sieve = [True] * n
    for i in range(3,int(n**0.5)+1,2):
        if sieve[i]:
            sieve[i*i::2*i]=[False]*((n-i*i-1)//(2*i)+1)
    return [2] + [i for i in range(3,n,2) if sieve[i]]

def binomial_coefficient(n, k):
    if 0 <= k <= n:
        ntok = 1
        ktok = 1
        for t in range(1, min(k, n - k) + 1):
            ntok *= n
            ktok *= t
            n -= 1
        return ntok // ktok
    else:
        return 0

def powerOfK(k, max):
    if k == 1:
        return [1]
    if k == -1:
        return [-1, 1]

    result = []
    n = 1
    while n <= max:
        result.append(n)
        n *= k
    return result

def divisors(n):
    i = 1
    result = []
    while i*i <= n:
        if n%i == 0:
            if n/i == i:
                result.append(i)
            else:
                result.append(i)
                result.append(n/i)
        i+=1
    return result

# @lru_cache(maxsize=None)
def digitsSum(n):
    if n == 0:
        return 0
    r = 0
    while n > 0:
        r += n % 10
        n //= 10
    return r

######################
# ---- GRID Fns ---- #
######################
def isValid(i, j, n, m):
    return i >= 0 and i < n and j >= 0 and j < m

def print_grid(grid):
    for line in grid:
        print(" ".join(map(str,line)))

######################
# ---- MISC Fns ---- #
######################
def kadane(a,size):
    max_so_far = 0
    max_ending_here = 0

    for i in range(0, size):
        max_ending_here = max_ending_here + a[i]
        if (max_so_far < max_ending_here):
            max_so_far = max_ending_here

        if max_ending_here < 0:
            max_ending_here = 0
    return max_so_far

def prefixSum(arr):
    for i in range(1, len(arr)):
        arr[i] = arr[i] + arr[i-1]
    return arr

def ceil(n, d):
    if n % d == 0:
        return n // d
    else:
        return (n // d) + 1

# INPUTS  --------------------------
# s = input().decode('utf-8').strip()
# n = int(input())
# l = list(map(int, input().split()))
# t = int(input())
# for _ in range(t):
# for _ in range(t):

def distance(xa, ya, xb, yb):
    return ((ya-yb)**2 + (xa-xb)**2)**(0.5)

xa, ya, xb, yb, xt, yt = list(map(int, input().split()))
n = int(input())

import math
bottles = []
ans = 0
ra, rb = [], []
for _ in range(n):
    xbt, ybt = list(map(int, input().split()))
    bottles.append((xbt, ybt))
    da = distance(xa, ya, xbt, ybt)
    db = distance(xb, yb, xbt, ybt)
    dt = distance(xt, yt, xbt, ybt)
    ra.append((da-dt, xbt, ybt, dt))
    rb.append((db-dt, xbt, ybt, dt))
    ans += 2*dt

ra = sorted(ra, key=lambda x: x[0])
rb = sorted(rb, key=lambda x: x[0])

if n == 1:
    print(ans+min(ra[0][0], rb[0][0]))
    exit()

a0 = ra[0]
a1 = ra[1]
b0 = rb[0]
b1 = rb[1]
if a0[0] <= 0 and b0[0] <= 0:
    if a0[1] == b0[1] and a0[2] == b0[2]:
        print(ans + min(min(0, a0[0]+b1[0]), min(0, b0[0]+a1[0])))
        exit()
    else:
        print(ans + a0[0] + b0[0])
        exit()
else:
    print(ans + min(a0[0], b0[0]))


import os,io
from sys import stdout
import collections
# import random
# import math
# from operator import itemgetter
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
# from collections import Counter
# from decimal import Decimal
# import heapq
# from functools import lru_cache

import sys
# import threading
# sys.setrecursionlimit(10**6)
# threading.stack_size(102400000)

# from functools import lru_cache
# @lru_cache(maxsize=None)

######################
# --- Maths Fns  --- #
######################
def primes(n):
    sieve = [True] * n
    for i in range(3,int(n**0.5)+1,2):
        if sieve[i]:
            sieve[i*i::2*i]=[False]*((n-i*i-1)//(2*i)+1)
    return [2] + [i for i in range(3,n,2) if sieve[i]]

def binomial_coefficient(n, k):
    if 0 <= k <= n:
        ntok = 1
        ktok = 1
        for t in range(1, min(k, n - k) + 1):
            ntok *= n
            ktok *= t
            n -= 1
        return ntok // ktok
    else:
        return 0

def powerOfK(k, max):
    if k == 1:
        return [1]
    if k == -1:
        return [-1, 1]

    result = []
    n = 1
    while n <= max:
        result.append(n)
        n *= k
    return result

def divisors(n):
    i = 1
    result = []
    while i*i <= n:
        if n%i == 0:
            if n/i == i:
                result.append(i)
            else:
                result.append(i)
                result.append(n/i)
        i+=1
    return result

# @lru_cache(maxsize=None)
def digitsSum(n):
    if n == 0:
        return 0
    r = 0
    while n > 0:
        r += n % 10
        n //= 10
    return r

######################
# ---- GRID Fns ---- #
######################
def isValid(i, j, n, m):
    return i >= 0 and i < n and j >= 0 and j < m

def print_grid(grid):
    for line in grid:
        print(" ".join(map(str,line)))

######################
# ---- MISC Fns ---- #
######################
def kadane(a,size):
    max_so_far = 0
    max_ending_here = 0

    for i in range(0, size):
        max_ending_here = max_ending_here + a[i]
        if (max_so_far < max_ending_here):
            max_so_far = max_ending_here

        if max_ending_here < 0:
            max_ending_here = 0
    return max_so_far

def prefixSum(arr):
    for i in range(1, len(arr)):
        arr[i] = arr[i] + arr[i-1]
    return arr

def ceil(n, d):
    if n % d == 0:
        return n // d
    else:
        return (n // d) + 1

# INPUTS  --------------------------
# s = input().decode('utf-8').strip()
# n = int(input())
# l = list(map(int, input().split()))
# t = int(input())
# for _ in range(t):
# for _ in range(t):

def distance(xa, ya, xb, yb):
    return ((ya-yb)**2 + (xa-xb)**2)**(0.5)

xa, ya, xb, yb, xt, yt = list(map(int, input().split()))
n = int(input())

import math
bottles = []
ans = 0
ra, rb = [], []
for _ in range(n):
    xbt, ybt = list(map(int, input().split()))
    bottles.append((xbt, ybt))
    da = distance(xa, ya, xbt, ybt)
    db = distance(xb, yb, xbt, ybt)
    dt = distance(xt, yt, xbt, ybt)
    ra.append((da-dt, xbt, ybt, dt))
    rb.append((db-dt, xbt, ybt, dt))
    ans += 2*dt

ra = sorted(ra, key=lambda x: x[0])
rb = sorted(rb, key=lambda x: x[0])

if n == 1:
    print(ans+min(ra[0][0], rb[0][0]))
    exit()

a0 = ra[0]
a1 = ra[1]
b0 = rb[0]
b1 = rb[1]
if a0[1] == b0[1] and a0[2] == b0[2]:
    print(ans + min(a0[0]+b1[0], b0[0]+a1[0]))
    exit()
else:
    print(ans + a0[0] + b0[0])
    exit()


def glen(x1,y1,x2,y2):
    return ((x1-x2)**2+(y1-y2)**2)**0.5
xa, ya, xb, yb, xt, yt = map(int,input().split())
n = int(input())
x = [0]*n
y = [0]*n
for i in range(n):
    x[i], y[i] = map(int,input().split())
inf = 10**10
afmin = [0, 0]
asmin = [0, 0]
for i in range(n):
    a = glen(xa,ya,x[i],y[i])-glen(xa,ya,xt,yt)-glen(xt,yt,x[i],y[i])
    if asmin[0] > a:
        asmin[0] = a
        asmin[1] = i
    if asmin[0] < afmin[0]: asmin,afmin = afmin, asmin
bfmin = [0, 0]
bsmin = [0, 0]
for i in range(n):
    b = glen(xb,yb,x[i],y[i])-glen(xb,yb,xt,yt)-glen(xt,yt,x[i],y[i])
    if bsmin[0] > b:
        bsmin[0] = b
        bsmin[1] = i
    if bsmin[0] < bfmin[0]: bsmin,bfmin = bfmin, bsmin
res = 0
b = bfmin[1]
a = afmin[1]
b1 = bsmin[1]
a1 = asmin[1]
res1 = min(glen(x[a], y[a], xa, ya) - glen(x[a],y[a],xt,yt),
     glen(x[b], y[b], xb, yb) - glen(x[b],y[b],xt,yt))

if b != a:
    res += glen(x[a], y[a], xa, ya) - glen(x[a],y[a],xt,yt)
    res += glen(x[b], y[b], xb, yb) - glen(x[b],y[b],xt,yt)
else:
    res += min(glen(x[a], y[a], xa, ya) - glen(x[a],y[a],xt,yt) + glen(x[b1], y[b1], xb, yb) - glen(x[b1],y[b1],xt,yt),
               glen(x[a1], y[a1], xa, ya) - glen(x[a],y[a],xt,yt) + glen(x[b], y[b], xb, yb) - glen(x[b1],y[b1],xt,yt))
for i in range(n):
    res += 2*glen(xt,yt,x[i],y[i])
    res1 += 2*glen(xt,yt,x[i],y[i])
print(min(res, res1))


def glen(x1,y1,x2,y2):
    return ((x1-x2)**2+(y1-y2)**2)**0.5
xa, ya, xb, yb, xt, yt = map(int,input().split())
n = int(input())
x = [0]*n
y = [0]*n
for i in range(n):
    x[i], y[i] = map(int,input().split())
inf = 10**10
afmin = [0, 0]
asmin = [0, 0]
for i in range(n):
    a = glen(xa,ya,x[i],y[i])-glen(xa,ya,xt,yt)-glen(xt,yt,x[i],y[i])
    if asmin[0] > a:
        asmin[0] = a
        asmin[1] = i
    if asmin[0] < afmin[0]: asmin,afmin = afmin, asmin
bfmin = [0, 0]
bsmin = [0, 0]
for i in range(n):
    b = glen(xb,yb,x[i],y[i])-glen(xb,yb,xt,yt)-glen(xt,yt,x[i],y[i])
    if bsmin[0] > b:
        bsmin[0] = b
        bsmin[1] = i
    if bsmin[0] < bfmin[0]: bsmin,bfmin = bfmin, bsmin
res = 0
b = bfmin[1]
a = afmin[1]
b1 = bsmin[1]
a1 = asmin[1]
if b != a:
    res += glen(x[a], y[a], xa, ya) - glen(x[a],y[a],xt,yt)
    res += glen(x[b], y[b], xb, yb) - glen(x[b],y[b],xt,yt)
else:
    res += min(glen(x[a], y[a], xa, ya) - glen(x[a],y[a],xt,yt) + glen(x[b1], y[b1], xb, yb) - glen(x[b1],y[b1],xt,yt),
               glen(x[a1], y[a1], xa, ya) - glen(x[a],y[a],xt,yt) + glen(x[b], y[b], xb, yb) - glen(x[b1],y[b1],xt,yt))
for i in range(n):
    res += 2*glen(xt,yt,x[i],y[i])
print(res)


def glen(x1,y1,x2,y2):
    return ((x1-x2)**2+(y1-y2)**2)**0.5
xa, ya, xb, yb, xt, yt = map(int,input().split())
n = int(input())
x = [0]*n
y = [0]*n
for i in range(n):
    x[i], y[i] = map(int,input().split())
inf = 10**10
afmin = [0, 0]
asmin = [0, 0]
for i in range(n):
    a = glen(xa,ya,x[i],y[i])-glen(xa,ya,xt,yt)-glen(xt,yt,x[i],y[i])
    if asmin[0] > a:
        asmin[0] = a
        asmin[1] = i
    if asmin[0] < afmin[0]: asmin,afmin = afmin, asmin
bfmin = [0, 0]
bsmin = [0, 0]
for i in range(n):
    b = glen(xb,yb,x[i],y[i])-glen(xb,yb,xt,yt)-glen(xt,yt,x[i],y[i])
    if bsmin[0] > b:
        bsmin[0] = b
        bsmin[1] = i
    if bsmin[0] < bfmin[0]: bsmin,bfmin = bfmin, bsmin
res = 0
b = bfmin[1]
a = afmin[1]
b1 = bsmin[1]
a1 = asmin[1]
res1 = min(glen(x[a], y[a], xa, ya) - glen(x[a],y[a],xt,yt),
     glen(x[b], y[b], xb, yb) - glen(x[b],y[b],xt,yt))

if b != a:
    res += glen(x[a], y[a], xa, ya) - glen(x[a],y[a],xt,yt)
    res += glen(x[b], y[b], xb, yb) - glen(x[b],y[b],xt,yt)
else:
    res += min(glen(x[a], y[a], xa, ya) - glen(x[a],y[a],xt,yt) + glen(x[b1], y[b1], xb, yb) - glen(x[b1],y[b1],xt,yt),
               glen(x[a1], y[a1], xa, ya) - glen(x[a],y[a],xt,yt) + glen(x[b], y[b], xb, yb) - glen(x[b1],y[b1],xt,yt))
for i in range(n):
    res += 2*glen(xt,yt,x[i],y[i])
    res1 += 2*glen(xt,yt,x[i],y[i])
if n == 1:
    res = 10**11
print(min(res, res1))


ax,ay,bx,by,tx,ty=map(int,input().split())
import math
n = int(input())
lisa=[]
lisb=[]
#lis=[]
inda=indb=-1
sa=sb=-100000000
cos=0
for i in range(n):
    a,b=map(int,input().split())
    dis=math.sqrt((a-tx)**2 + (b-ty)**2)
    disa=math.sqrt((ax-a)**2 + (ay-b)**2)
    disb=math.sqrt((bx-a)**2 + (by-b)**2)
    lisa.append([dis-disa,i])
    lisb.append([dis-disb,i])
#    lis.append(dis)
    cos+=(2*dis)
lisa.sort(reverse=True)
lisb.sort(reverse=True)
#print(lisa,lisb)
if lisa[0][0]>lisb[0][0]:
    cos-=lisa[0][0]
    if lisb[0][0]>0 and lisb[0][1]!=lisa[0][1]:
        cos-=lisb[0][0]
    elif len(lisb)>1 and lisb[1][0]>0:
        cos-=lisb[1][0]
    print(cos)
else:
    cos-=lisb[0][0]
    if lisa[0][0]>0 and lisa[0][1]!=lisb[0][1]:
        cos-=lisa[0][0]
    else:
        cos-=lisa[1][0]
    print(cos)


ax,ay,bx,by,tx,ty=map(int,input().split())
import math
n = int(input())
lisa=[]
lisb=[]
lis=[]
inda=indb=-1
sa=sb=-100000000
cos=0
for i in range(n):
    a,b=map(int,input().split())
    dis=math.sqrt((a-tx)**2 + (b-ty)**2)
    disa=math.sqrt((ax-a)**2 + (ay-b)**2)
    disb=math.sqrt((bx-a)**2 + (by-b)**2)
    lisa.append([dis-disa,i])
    lisb.append([dis-disb,i])
    lis.append(dis)
    cos+=(2*dis)
lisa.sort(reverse=True)
lisb.sort(reverse=True)
#print(lisa)
#print(lisb,cos)
if lisa[0][1]!=lisb[0][1]:
    aa=max(lisa[0][0]+lisb[0][0],lisa[0][0],lisb[0][0])
    print(cos-aa)
else:
    aa=0
    if len(lisa)>1 and len(lisb)>1:
        aa=max(lisa[0][0]+lisb[1][0],lisa[1][0]+lisb[0][0],lisa[0][0],lisb[0][0])
    elif len(lisa)>1:
        aa=max(lisa[1][0]+lisb[0][0],lisa[0][0],lisb[0][0])
    elif len(lisb)>1:
        aa=max(lisa[0][0]+lisb[1][0],lisa[0][0],lisb[0][0])
    elif len(lisa)==len(lisb)==1 :
        aa=max(lisa[0][0],lisb[0][0])
#    elif len(lisa)==1 and len(lisb)==1:
#        aa=max(lisa[0][0],lisb[0][0])
    print(cos-aa)


__author__ = 'Utena'
import math
import operator
ax,ay,bx,by,tx,ty=map(int,input().split())
n=int(input())
D=[]
DA=[]
DB=[]
for i in range(n):
    x,y=map(int,input().split())
    d=math.sqrt((x-tx)**2+(y-ty)**2)
    da=math.sqrt((x-ax)**2+(y-ay)**2)
    db=math.sqrt((x-bx)**2+(y-by)**2)
    D.append(d)
    DA.append((d-da,i))
    DB.append((d-db,i))
DA=sorted(DA,key=operator.itemgetter(0),reverse=1)
DB=sorted(DB,key=operator.itemgetter(0),reverse=1)
if DA[0][0] and DB[0][0]<=0:
    m=max(DA[0][0],DB[0][0])
    ans=2*sum(D)-m
elif DA[0][0]<=0 and DB[0][0]>0:
    ans=2*sum(D)-DB[0][0]
elif DB[0][0]<=0 and DA[0][0]>0:
    ans=2*sum(D)-DA[0][0]
else:
    if DA[0][1]==DB[0][1]:
        m=max((DA[0][0]+DB[1][0]),(DA[1][0]+DB[0][0]))
        ans=2*sum(D)-m
    else:
        m=DA[0][0]+DB[0][0]
        ans=2*sum(D)-m
print(ans)


__author__ = 'Utena'
import math
import operator
ax,ay,bx,by,tx,ty=map(int,input().split())
n=int(input())
D=[]
DA=[]
DB=[]
for i in range(n):
    x,y=map(int,input().split())
    d=math.sqrt((x-tx)**2+(y-ty)**2)
    da=math.sqrt((x-ax)**2+(y-ay)**2)
    db=math.sqrt((x-bx)**2+(y-by)**2)
    D.append(d)
    DA.append((d-da,i))
    DB.append((d-db,i))
DA=sorted(DA,key=operator.itemgetter(0),reverse=1)
DB=sorted(DB,key=operator.itemgetter(0),reverse=1)
if DA[0][0] and DB[0][0]<=0:
    m=max(DA[0][0],DB[0][0])
    ans=2*sum(D)-m
elif DA[0][0]<=0 and DB[0][0]>0:
    ans=2*sum(D)-DB[0][0]
elif DB[0][0]<=0 and DA[0][0]>0:
    ans=2*sum(D)-DA[0][0]
else:
    if DA[0][1]==DB[0][1]:
        m=max((DA[0][0]+DB[1][0]),(DA[1][0]+DB[0][0]),(DA[0][0]+0),(DA[1][0]+0))
        ans=2*sum(D)-m
    else:
        m=DA[0][0]+DB[0][0]
        ans=2*sum(D)-m
print(ans)


import math

def dist(a, b):
  x = abs(a[0] - b[0])
  y = abs(a[1] - b[1])
  return math.sqrt(x * x + y * y)

def path(a, b, c):
  return dist(a, b) + dist(b, c)

def findb(ap, bp, tp, gb):
  adiff = 0.0
  abest = set()
  for gp in gb:
    x = dist(gp, tp) - dist(ap, gp)
    if x > adiff:
      adiff = x
      abest = gp

  bdiff = 0.0
  for gp in gb:
    if gp == abest:
      continue
    x = dist(gp, tp) - dist(bp, gp)
    if x > bdiff:
      bdiff = x

  return adiff + bdiff

def solve():
  ax, ay, bx, by, tx, ty = [int(x) for x in input().split()]
  n = int(input())
  gb = []
  for _ in range(n):
    a, b = [int(x) for x in input().split()]
    gb.append((a, b))

  ap = (ax, ay)
  bp = (bx, by)
  tp = (tx, ty)
  total = 0.0
  for gp in gb:
    total += dist(gp, tp) * 2

  aa = findb(ap, bp, tp, gb)
  bb = findb(bp, ap, tp, gb)

  if aa > bb:
    print(total - aa)
  else:
    print(total - bb)

if __name__ == '__main__':
  solve()


import math

def dist(a, b):
  x = abs(a[0] - b[0])
  y = abs(a[1] - b[1])
  return math.sqrt(x * x + y * y)

def path(a, b, c):
  return dist(a, b) + dist(b, c)

def findb(ap, bp, tp, gb):
  adiff = -1e10
  abest = set()
  for gp in gb:
    x = dist(gp, tp) - dist(ap, gp)
    if x > adiff:
      adiff = x
      abest = gp

  bdiff = 0.0
  for gp in gb:
    if gp == abest:
      continue
    x = dist(gp, tp) - dist(bp, gp)
    if x > bdiff:
      bdiff = x

  return adiff + bdiff

def solve():
  ax, ay, bx, by, tx, ty = [int(x) for x in input().split()]
  n = int(input())
  gb = []
  for _ in range(n):
    a, b = [int(x) for x in input().split()]
    gb.append((a, b))

  ap = (ax, ay)
  bp = (bx, by)
  tp = (tx, ty)
  total = 0.0
  for gp in gb:
    total += dist(gp, tp) * 2

  aa = findb(ap, bp, tp, gb)
  bb = findb(bp, ap, tp, gb)

  if aa > bb:
    print(total - aa)
  else:
    print(total - bb)

if __name__ == '__main__':
  solve()


def distance(x1, y1, x2, y2):
    return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5

def second_smallest(arr, temp_x, temp_y, tx, ty):
    smallest_index = arr.index(max(arr, key = lambda T : distance(tx, ty, *T) - distance(ax, ay, *T)))
    d = 10**9
    index = -1
    for i, v in enumerate(arr):
        x, y = v
        dist = -distance(x, y, tx, ty) + distance(x, y, temp_x, temp_y)
        if dist < d and smallest_index != i:
            d = dist
            index = i
    return index

ax, ay, bx, by, tx, ty = map(int, input().split())

n = int(input())

arr = list()

for i in range(n):
    x, y = map(int, input().split())
    arr.append((x, y))

if n == 1:
    print(min(distance(ax, ay, *arr[0]), distance(bx, by, *arr[0])) +
            distance(tx, ty, *arr[0]))
    exit()

ans = 2 * sum(distance(tx, ty, x, y) for x, y in arr)

index1 = arr.index(max(arr, key = lambda T : distance(tx, ty, *T) - distance(ax, ay, *T)))
index2 = arr.index(max(arr, key = lambda T : distance(tx, ty, *T) - distance(bx, by, *T)))

if index1 != index2:
    ans -= distance(tx, ty, *arr[index1])
    ans -= distance(tx, ty, *arr[index2])
    ans += distance(ax, ay, *arr[index1])
    ans += distance(bx, by, *arr[index2])
    print(ans)
else:
    p, q = ans, ans
    p -= distance(tx, ty, *arr[index1])
    p += distance(ax, ay, *arr[index1])
    temp_index = second_smallest(arr, bx, by, tx, ty)
    if distance(bx, by, *arr[temp_index]) < distance(tx, ty, *arr[temp_index]):
        p -= distance(tx, ty, *arr[temp_index])
        p += distance(bx, by, *arr[temp_index])
    q -= distance(tx, ty, *arr[index2])
    q += distance(bx, by, *arr[index2])
    temp_index = second_smallest(arr, ax, ay, tx, ty)
    if distance(ax, ay, *arr[temp_index]) < distance(tx, ty, *arr[temp_index]):
        q -= distance(tx, ty, *arr[temp_index])
        q += distance(ax, ay, *arr[temp_index])
    print(min(p, q))


def distance(x1, y1, x2, y2):
    return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5

def second_smallest(arr, temp_x, temp_y, tx, ty):
    smallest_index = arr.index(max(arr, key = lambda T : distance(tx, ty, *T) - distance(ax, ay, *T)))
    d = 10**30
    index = -1
    for i, v in enumerate(arr):
        x, y = v
        dist = -distance(x, y, tx, ty) + distance(x, y, temp_x, temp_y)
        if dist < d and smallest_index != i:
            d = dist
            index = i
    return index

ax, ay, bx, by, tx, ty = map(int, input().split())

n = int(input())

arr = list()

for i in range(n):
    x, y = map(int, input().split())
    arr.append((x, y))

if n == 1:
    print(min(distance(ax, ay, *arr[0]), distance(bx, by, *arr[0])) +
            distance(tx, ty, *arr[0]))
    exit()

ans = 2 * sum(distance(tx, ty, x, y) for x, y in arr)

index1 = arr.index(max(arr, key = lambda T : distance(tx, ty, *T) - distance(ax, ay, *T)))
index2 = arr.index(max(arr, key = lambda T : distance(tx, ty, *T) - distance(bx, by, *T)))

if index1 != index2:
    ans -= distance(tx, ty, *arr[index1])
    ans -= distance(tx, ty, *arr[index2])
    ans += distance(ax, ay, *arr[index1])
    ans += distance(bx, by, *arr[index2])
    print(ans)
else:
    p, q = ans, ans
    p -= distance(tx, ty, *arr[index1])
    p += distance(ax, ay, *arr[index1])
    temp_index = second_smallest(arr, bx, by, tx, ty)
    if distance(bx, by, *arr[temp_index]) < distance(tx, ty, *arr[temp_index]):
        p -= distance(tx, ty, *arr[temp_index])
        p += distance(bx, by, *arr[temp_index])
    q -= distance(tx, ty, *arr[index2])
    q += distance(bx, by, *arr[index2])
    temp_index = second_smallest(arr, ax, ay, tx, ty)
    if distance(ax, ay, *arr[temp_index]) < distance(tx, ty, *arr[temp_index]):
        q -= distance(tx, ty, *arr[temp_index])
        q += distance(ax, ay, *arr[temp_index])
    print(min(p, q))


def distance(x1, y1, x2, y2):
    return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5

def second_smallest(arr, temp_x, temp_y, tx, ty):
    smallest_index = arr.index(
        max(arr, key=lambda T: distance(tx, ty, *T) - distance(ax, ay, *T)))
    d = 10**30
    index = -1
    for i, v in enumerate(arr):
        x, y = v
        dist = -distance(x, y, tx, ty) + distance(x, y, temp_x, temp_y)
        if dist < d and smallest_index != i:
            d = dist
            index = i
    return index

ax, ay, bx, by, tx, ty = map(int, input().split())

n = int(input())

arr = list()

for i in range(n):
    x, y = map(int, input().split())
    arr.append((x, y))

if n == 1:
    print(min(distance(ax, ay, *arr[0]), distance(bx, by, *arr[0])) +
          distance(tx, ty, *arr[0]))
    exit()

ans = 2 * sum(distance(tx, ty, x, y) for x, y in arr)

index1 = arr.index(max(arr, key=lambda T: distance(
    tx, ty, *T) - distance(ax, ay, *T)))
index2 = arr.index(max(arr, key=lambda T: distance(
    tx, ty, *T) - distance(bx, by, *T)))

if index1 != index2:
    if distance(tx, ty, *arr[index1]) > distance(ax, ay, *arr[index1]):
        ans -= distance(tx, ty, *arr[index1])
        ans += distance(ax, ay, *arr[index1])
    if distance(tx, ty, *arr[index2]) > distance(bx, by, *arr[index2]):
        ans -= distance(tx, ty, *arr[index2])
        ans += distance(bx, by, *arr[index2])
    if distance(tx, ty, *arr[index1]) < distance(ax, ay, *arr[index1]
                                                 ) and distance(tx, ty, *arr[index2]) < distance(bx, by, *arr[index2]):
        p, q = distance(tx, ty, *arr[index1]) - distance(ax, ay, *arr[index1]), distance(
            tx, ty, *arr[index2]) - distance(bx, by, *arr[index2])
        ans -= max(p, q)
    print(ans)
else:
    p, q = ans, ans
    p -= distance(tx, ty, *arr[index1])
    p += distance(ax, ay, *arr[index1])
    temp_index = second_smallest(arr, bx, by, tx, ty)
    if distance(bx, by, *arr[temp_index]) < distance(tx, ty, *arr[temp_index]):
        p -= distance(tx, ty, *arr[temp_index])
        p += distance(bx, by, *arr[temp_index])
    q -= distance(tx, ty, *arr[index2])
    q += distance(bx, by, *arr[index2])
    temp_index = second_smallest(arr, ax, ay, tx, ty)
    if distance(ax, ay, *arr[temp_index]) < distance(tx, ty, *arr[temp_index]):
        q -= distance(tx, ty, *arr[temp_index])
        q += distance(ax, ay, *arr[temp_index])
    print(min(p, q))


def distance(x1, y1, x2, y2):
    return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5

def second_smallest(arr, temp_x, temp_y, tx, ty):
    smallest_index = arr.index(
        max(arr, key=lambda T: distance(tx, ty, *T) - distance(ax, ay, *T)))
    d = 10**20
    index = -1
    for i, v in enumerate(arr):
        x, y = v
        dist = -distance(x, y, tx, ty) + distance(x, y, temp_x, temp_y)
        if dist < d and smallest_index != i:
            d = dist
            index = i
    return index

ax, ay, bx, by, tx, ty = map(int, input().split())

n = int(input())

arr = list()

for i in range(n):
    x, y = map(int, input().split())
    arr.append((x, y))

if n == 1:
    print(min(distance(ax, ay, *arr[0]), distance(bx, by, *arr[0])) +
          distance(tx, ty, *arr[0]))
    exit()

distances = [(distance(ax, ay, x, y), distance(bx, by, x, y), distance(tx, ty,
                                                                       x, y)) for x, y in arr]

ans = 2 * sum(v[2] for v in distances)

index1 = distances.index(max(distances, key=lambda T: T[2] - T[0]))
index2 = distances.index(max(distances, key=lambda T: T[2] - T[1]))

if index1 != index2:
    if distance(tx, ty, *arr[index1]) > distance(ax, ay, *arr[index1]):
        ans -= distance(tx, ty, *arr[index1])
        ans += distance(ax, ay, *arr[index1])
    if distance(tx, ty, *arr[index2]) > distance(bx, by, *arr[index2]):
        ans -= distance(tx, ty, *arr[index2])
        ans += distance(bx, by, *arr[index2])
    if distance(tx, ty, *arr[index1]) < distance(ax, ay, *arr[index1]
                                                 ) and distance(tx, ty, *arr[index2]) < distance(bx, by, *arr[index2]):
        p, q = distance(tx, ty, *arr[index1]) - distance(ax, ay, *arr[index1]), distance(
            tx, ty, *arr[index2]) - distance(bx, by, *arr[index2])
        ans -= max(p, q)
    print(ans)
else:
    p, q = ans, ans
    p -= distance(tx, ty, *arr[index1])
    p += distance(ax, ay, *arr[index1])
    temp_index = second_smallest(arr, bx, by, tx, ty)
    if distance(bx, by, *arr[temp_index]) < distance(tx, ty, *arr[temp_index]):
        p -= distance(tx, ty, *arr[temp_index])
        p += distance(bx, by, *arr[temp_index])
    q -= distance(tx, ty, *arr[index2])
    q += distance(bx, by, *arr[index2])
    temp_index = second_smallest(arr, ax, ay, tx, ty)
    if distance(ax, ay, *arr[temp_index]) < distance(tx, ty, *arr[temp_index]):
        q -= distance(tx, ty, *arr[temp_index])
        q += distance(ax, ay, *arr[temp_index])
    print(min(p, q))


def distance(x, y, a, b):
    return ((x - a) ** 2 + (y - b) ** 2) ** 0.5

ax, ay, bx, by, tx, ty = map(int, input().split())
n = int(input())

arr = []

for i in range(n):
    x, y = map(int, input().split())
    arr.append((x, y))

temp1 = [(distance(ax, ay, *arr[i]), distance(bx, by, *arr[i]), distance(tx, ty,
    *arr[i]), -distance(ax, ay, *arr[i]) + distance(tx, ty, *arr[i]), -distance(bx,
        by, *arr[i]) + distance(tx, ty, *arr[i])) for i in range(n)]

temp2 = temp1[:]

temp1.sort(key = lambda T : T[-2], reverse = True)
temp2.sort(key = lambda T : T[-1], reverse = True)

ans1, ans2 = 0, 0

ans1 += temp1[0][0] + temp1[0][2]

del temp1[0]

temp1.sort(key = lambda T : T[-1], reverse = True)

if len(temp1):
    if temp1[0][1] < temp1[0][2]:
        ans1 += temp1[0][1] + temp1[0][2]
    else:
        ans1 += 2 * temp1[0][2]

if len(temp1):
    del temp1[0]

for i in range(len(temp1)):
    ans1 += 2 * temp1[i][2]

ans2 += temp2[0][1] + temp2[0][2]

del temp2[0]

temp2.sort(key = lambda T : T[-2], reverse = True)

if len(temp2):
    if temp2[0][0] < temp2[0][2]:
        ans2 += temp2[0][0] + temp2[0][2]
    else:
        ans2 += 2 * temp2[0][2]

if len(temp2):
    del temp2[0]

for i in range(len(temp2)):
    ans2 += 2 * temp2[0][2]

print(min(ans1, ans2))


def distance(x, y, a, b):
    return ((x - a) ** 2 + (y - b) ** 2) ** 0.5

ax, ay, bx, by, tx, ty = map(int, input().split())
n = int(input())

arr = []

for i in range(n):
    x, y = map(int, input().split())
    arr.append((x, y))

temp1 = [(distance(ax, ay, *arr[i]), distance(bx, by, *arr[i]), distance(tx, ty,
    *arr[i]), -distance(ax, ay, *arr[i]) + distance(tx, ty, *arr[i]), -distance(bx,
        by, *arr[i]) + distance(tx, ty, *arr[i])) for i in range(n)]

temp2 = temp1[:]

temp1.sort(key = lambda T : T[-2], reverse = True)
temp2.sort(key = lambda T : T[-1], reverse = True)

ans1, ans2 = 0, 0

ans1 += temp1[0][0] + temp1[0][2]

del temp1[0]

temp1.sort(key = lambda T : T[-1], reverse = True)

if temp1[0][1] < temp1[0][2]:
    ans1 += temp1[0][1] + temp1[0][2]
else:
    ans1 += 2 * temp1[0][2]

del temp1[0]

for i in range(len(temp1)):
    ans1 += 2 * temp1[i][2]

ans2 += temp2[0][1] + temp2[0][2]

del temp2[0]

temp2.sort(key = lambda T : T[-2], reverse = True)

if temp2[0][0] < temp2[0][2]:
    ans2 += temp2[0][0] + temp2[0][2]
else:
    ans2 += 2 * temp2[0][2]

del temp2[0]

for i in range(len(temp2)):
    ans2 += 2 * temp2[0][2]

print(min(ans1, ans2))


def distance(x1, y1, x2, y2):
    return ((x1 - x2) ** 2 + (y1 - y2) ** 2) ** 0.5

def second_smallest(arr, temp_x, temp_y, tx, ty):
    smallest_index = arr.index(max(arr, key = lambda T : distance(tx, ty, *T) - distance(ax, ay, *T)))
    d = 10**30
    index = -1
    for i, v in enumerate(arr):
        x, y = v
        dist = -distance(x, y, tx, ty) + distance(x, y, temp_x, temp_y)
        if dist < d and smallest_index != i:
            d = dist
            index = i
    return index

ax, ay, bx, by, tx, ty = map(int, input().split())

n = int(input())

arr = list()

for i in range(n):
    x, y = map(int, input().split())
    arr.append((x, y))

if n == 1:
    print(min(distance(ax, ay, *arr[0]), distance(bx, by, *arr[0])) +
            distance(tx, ty, *arr[0]))
    exit()

ans = 2 * sum(distance(tx, ty, x, y) for x, y in arr)

index1 = arr.index(max(arr, key = lambda T : distance(tx, ty, *T) - distance(ax, ay, *T)))
index2 = arr.index(max(arr, key = lambda T : distance(tx, ty, *T) - distance(bx, by, *T)))

if index1 != index2:
    ans -= distance(tx, ty, *arr[index1])
    ans -= distance(tx, ty, *arr[index2])
    ans += distance(ax, ay, *arr[index1])
    ans += distance(bx, by, *arr[index2])
    print(ans)
else:
    if n == 33:
        print('Else')
    p, q = ans, ans
    p -= distance(tx, ty, *arr[index1])
    p += distance(ax, ay, *arr[index1])
    temp_index = second_smallest(arr, bx, by, tx, ty)
    if distance(bx, by, *arr[temp_index]) < distance(tx, ty, *arr[temp_index]):
        p -= distance(tx, ty, *arr[temp_index])
        p += distance(bx, by, *arr[temp_index])
    q -= distance(tx, ty, *arr[index2])
    q += distance(bx, by, *arr[index2])
    temp_index = second_smallest(arr, ax, ay, tx, ty)
    if distance(ax, ay, *arr[temp_index]) < distance(tx, ty, *arr[temp_index]):
        q -= distance(tx, ty, *arr[temp_index])
        q += distance(ax, ay, *arr[temp_index])
    print(min(p, q))


import heapq
import itertools

def get_best_two(x, y, bin_bottle_distances):
    heap = []

    for ibin_distance_square, (idx, (ix, iy)) in zip(bin_bottle_distances, enumerate(bottle_xys)):
        distance = ((ix - x) ** 2 + (iy - y)**2) ** 0.5 - ibin_distance_square
        if len(heap) < 2:
            heapq.heappush(heap, (-distance, idx))
        else:
            heapq.heappushpop(heap, (-distance, idx))

    return sorted([(-i, j) for i, j in heap])

def solve(ax, ay, bx, by, tx, ty, bottle_xys):
    if not bottle_xys:
        return 0

    bin_bottle_distances = [((tx - ix) ** 2 + (ty - iy) ** 2) ** 0.5 for ix, iy in bottle_xys]

    a_best_two = get_best_two(ax, ay, bin_bottle_distances) + [(0, None)]
    b_best_two = get_best_two(bx, by, bin_bottle_distances) + [(0, None)]

    from_bin_distance = sum(map(lambda x: x * 2, bin_bottle_distances))

    result = from_bin_distance

    for (a_distance, a_idx), (b_distance, b_idx) in itertools.product(a_best_two, b_best_two):
        if a_idx == b_idx:
            continue

        case_result = from_bin_distance + a_distance + b_distance
        result = min(case_result, result)

    return result

R = lambda: map(int, raw_input().split())
ax, ay, bx, by, tx, ty = R()
bottle_xys = [R() for _ in xrange(int(raw_input()))]

print solve(ax, ay, bx, by, tx, ty, bottle_xys)

"""
   x
 o
 xx
0  o
"""


import heapq
import itertools

def get_best_two(x, y, bin_bottle_distances):
    heap = []

    for ibin_distance_square, (idx, (ix, iy)) in zip(bin_bottle_distances, enumerate(bottle_xys)):
        distance = ((ix - x) ** 2 + (iy - y)**2) ** 0.5 - ibin_distance_square
        if len(heap) < 2:
            heapq.heappush(heap, (-distance, idx))
        else:
            heapq.heappushpop(heap, (-distance, idx))

    return sorted([(-i, j) for i, j in heap])

def solve(ax, ay, bx, by, tx, ty, bottle_xys):
    if not bottle_xys:
        return 0

    bin_bottle_distances = [((tx - ix) ** 2 + (ty - iy) ** 2) ** 0.5 for ix, iy in bottle_xys]

    a_best_two = get_best_two(ax, ay, bin_bottle_distances) + [(0, None)]
    b_best_two = get_best_two(bx, by, bin_bottle_distances) + [(0, None)]

    from_bin_distance = sum(map(lambda x: x * 2, bin_bottle_distances))

    result = float('inf')

    for (a_distance, a_idx), (b_distance, b_idx) in itertools.product(a_best_two, b_best_two):
        if a_idx == b_idx:
            continue

        case_result = from_bin_distance + a_distance + b_distance
        result = min(case_result, result)

    return result

R = lambda: map(int, raw_input().split())
ax, ay, bx, by, tx, ty = R()
bottle_xys = [R() for _ in xrange(int(raw_input()))]

print solve(ax, ay, bx, by, tx, ty, bottle_xys)


from math import sqrt
R=lambda:map(int,raw_input().split())
ax,ay,bx,by,tx,ty=R()
start=[(ax,ay),(bx,by)]
n=input()
pos=[R() for _ in range(n)]
dis=[sqrt((x[0]-tx)**2+(x[1]-ty)**2) for x in pos]
tot=sum(dis)*2
D=lambda k,i:sqrt((start[k][0]-pos[i][0])**2+(start[k][1]-pos[i][1])**2)-dis[i]
disab=[sorted([(D(0,i),i) for i in  range(n)]),sorted([(D(1,i),i) for i in range(n)])]
ans=10**18
flag=0
for k in range(2):
    for d,i in disab[k]:
        if d<0:
            flag=1
            d1=disab[k^1][0][0] if i!=disab[k^1][0][1] else disab[k^1][1][0] if n>1 else 0
            if d1>0:d1=0
            ans=min(ans,tot+d+d1)
print ans if flag else tot+min(disab[0][0],disab[1][0])


from math import sqrt
R=lambda:map(int,raw_input().split())
ax,ay,bx,by,tx,ty=R()
start=[(ax,ay),(bx,by)]
n=input()
pos=[R() for _ in range(n)]
dis=[sqrt((x[0]-tx)**2+(x[1]-ty)**2) for x in pos]
tot=sum(dis)*2
D=lambda k,i:sqrt((start[k][0]-pos[i][0])**2+(start[k][1]-pos[i][1])**2)-dis[i]
disab=[[(D(0,i),i) for i in range(n)],[(D(1,i),i) for i in range(n)]]
disab[0].sort()
disab[1].sort()
ans=10**18
flag=0
for k in range(2):
    for d,i in disab[k]:
        if d<0:
            flag=1
            d1=disab[k^1][0][0] if i!=disab[k^1][0][1] else disab[k^1][1][0] if n>1 else 0
            if d1>0:d1=0
            ans=min(ans,tot+d+d1)
print ans if flag else tot+min(disab[0][0][0],disab[1][0][0])


from math import sqrt
R=lambda:map(int,raw_input().split())
ax,ay,bx,by,tx,ty=R()
start=[(ax,ay),(bx,by)]
n=input()
pos=[R() for _ in range(n)]
dis=[sqrt((x[0]-tx)**2+(x[1]-ty)**2) for x in pos]
tot=sum(dis)*2
D=lambda k,i:sqrt((start[k][0]-pos[i][0])**2+(start[k][1]-pos[i][1])**2)-dis[i]
disab=[[(D(0,i),i) for i in range(n)],[(D(1,i),i) for i in range(n)]]
disab[0].sort()
disab[1].sort()
ans=10**18
flag=0
for k in range(2):
    for d,i in disab[k]:
        if d<0:
            flag=1
            d1=disab[k^1][0][0] if i!=disab[k^1][0][1] else disab[k^1][1][0] if n>1 else 0
            if d1>0:d1=0
            ans=min(ans,tot+d+d1)
print ans if flag else tot+min(disab[0][0],disab[1][0])


import math

def dist_points(A, B):
	return math.sqrt(math.pow(A[0]-B[0],2)+math.pow(A[1]-B[1],2))

line = raw_input().strip().split()

pos_A = (int(line[0]), int(line[1]))
pos_B = (int(line[2]), int(line[3]))
R = (int(line[4]), int(line[5]))

#cases when either of them don't walk at all

total_points = int(raw_input())
points = []
for _ in xrange(total_points):
	line = raw_input().split()
	points.append((int(line[0]), int(line[1])))

from_recycle_to_points = []

for _ in xrange(total_points):
	dist = dist_points(points[_], R)
	from_recycle_to_points.append(dist)

from_A_to_points = []

for _ in xrange(total_points):
	dist = dist_points(points[_], pos_A)
	from_A_to_points.append(dist)

from_B_to_points = []

for _ in xrange(total_points):
	dist = dist_points(points[_], pos_B)
	from_B_to_points.append(dist)

total_if_all = 0

for el in from_recycle_to_points:
	total_if_all += 2*el

#only A walks

try_minimize_A = total_if_all - from_recycle_to_points[0] + from_A_to_points[0]
chosen_point_A = 0

for index in xrange(1,total_points):
	potential = total_if_all - from_recycle_to_points[index] + from_A_to_points[index]
	if potential < try_minimize_A:
		try_minimize_A = potential
		chosen_point_A = index

#only B walks
try_minimize_B = total_if_all - from_recycle_to_points[0] + from_B_to_points[0]
chosen_point_B = 0

for index in xrange(1,total_points):
	potential = total_if_all - from_recycle_to_points[index] + from_B_to_points[index]
	if potential < try_minimize_B:
		try_minimize_B = potential
		chosen_point_B = index

potential_min = min(try_minimize_A, try_minimize_B)

#now case if both will walk
if chosen_point_A != chosen_point_B:
	result = total_if_all - from_recycle_to_points[chosen_point_A] - from_recycle_to_points[chosen_point_B] + from_B_to_points[chosen_point_B] + from_A_to_points[chosen_point_A]
	print result
else:
	try_minimize_A = total_if_all + from_A_to_points[0]
	second_best_point_A = 0
	for index in xrange(1,total_points):
		if index == chosen_point_A: continue
		potential = total_if_all - from_recycle_to_points[index] + from_A_to_points[index]
		if potential < try_minimize_A:
			try_minimize_A = potential
			second_best_point_A = index

	#only B walks
	try_minimize_A = total_if_all + from_B_to_points[0]
	second_best_point_B = 0
	for index in xrange(1,total_points):
		if index == chosen_point_B: continue
		potential = total_if_all - from_recycle_to_points[index] + from_B_to_points[index]
		if potential < try_minimize_A:
			try_minimize_A = potential
			second_best_point_B = index
	new_compare_A = total_if_all - from_recycle_to_points[chosen_point_A] - from_recycle_to_points[second_best_point_B] + from_B_to_points[second_best_point_B] + from_A_to_points[chosen_point_A]
	new_compare_B = total_if_all - from_recycle_to_points[second_best_point_A] - from_recycle_to_points[chosen_point_B] + from_B_to_points[chosen_point_B] + from_A_to_points[second_best_point_A]
	print min(new_compare_A, new_compare_B, potential_min)


import math

def dist_points(A, B):
	return math.sqrt(math.pow(A[0]-B[0],2)+math.pow(A[1]-B[1],2))

def solution(points, A, B, R, total_if_all):
	if len(points) == 0:
		return 0.0
	if len(points) == 1:
		return min(A[0]+R[0], B[0]+R[0])
	else:
		total_A = total_if_all - R[0] + A[0]
		shortest_A = 0
		total_B = total_if_all - R[0] + B[0]
		shortest_B = 0
		for point in xrange(0, len(points)):
			candidate_A = total_if_all - R[point] + A[point]
			candidate_B = total_if_all - R[point] + B[point]
			if total_A > candidate_A:
				shortest_A = point
				total_A = candidate_A
			if total_B > candidate_B:
				shortest_B = point
				total_B = candidate_B

		all_candidates = [
			total_A, total_B
		]

		second_shortest_A = 0 if shortest_A > 0 else 1
		total_A = total_if_all - R[second_shortest_A] + A[second_shortest_A]
		second_shortest_B = 0 if shortest_B > 0 else 1
		total_B = total_if_all - R[second_shortest_B] + B[second_shortest_B]
		for point in xrange(0, len(points)):
			if point != shortest_A:
				candidate_A = total_if_all - R[point] + A[point]
				if total_A > candidate_A:
					second_shortest_A = point
					total_A = candidate_A
			if point != shortest_B:
				candidate_B = total_if_all - R[point] + B[point]
				if total_B > candidate_B:
					second_shortest_B = point
					total_B = candidate_B

		if shortest_A != shortest_B:
			all_candidates.append(total_if_all - R[shortest_A] + A[shortest_A] - R[shortest_B] + B[shortest_B])
		else:
			all_candidates.append(total_if_all - R[shortest_A] + A[shortest_A] - R[second_shortest_B] + B[second_shortest_B])
			all_candidates.append(total_if_all - R[second_shortest_A] + A[second_shortest_A] - R[shortest_B] + B[shortest_B])
		return min(all_candidates)

line = raw_input().strip().split()

pos_A = (int(line[0]), int(line[1]))
pos_B = (int(line[2]), int(line[3]))
R = (int(line[4]), int(line[5]))

#cases when either of them don't walk at all

total_points = int(raw_input())
points = []
for _ in xrange(total_points):
	line = raw_input().split()
	points.append((int(line[0]), int(line[1])))

from_recycle_to_points = []

for _ in xrange(total_points):
	dist = dist_points(points[_], R)
	from_recycle_to_points.append(dist)

from_A_to_points = []

for _ in xrange(total_points):
	dist = dist_points(points[_], pos_A)
	from_A_to_points.append(dist)

from_B_to_points = []

for _ in xrange(total_points):
	dist = dist_points(points[_], pos_B)
	from_B_to_points.append(dist)

total_if_all = 0

for el in from_recycle_to_points:
	total_if_all += 2*el

print solution(points, from_A_to_points, from_B_to_points, from_recycle_to_points, total_if_all)


import math

def dist_points(A, B):
	return math.sqrt(math.pow(A[0]-B[0],2)+math.pow(A[1]-B[1],2))

def solution(points, A, B, R, total_if_all):
	if len(points) == 0:
		return 0.0
	if len(points) == 1:
		return min(A[0]+R[0], B[0]+R[0])
	else:
		total_A = total_if_all - R[0] + A[0]
		shortest_A = 0
		total_B = total_if_all - R[0] + B[0]
		shortest_B = 0
		for point in xrange(0, len(points)):
			candidate_A = total_if_all - R[point] + A[point]
			candidate_B = total_if_all - R[point] + B[point]
			if total_A > candidate_A:
				shortest_A = point
				total_A = candidate_A
			if total_B > candidate_B:
				shortest_B = point
				total_B = candidate_B
		second_shortest_A = 0 if shortest_A > 0 else 1
		total_A = total_if_all - R[second_shortest_A] + A[second_shortest_A]
		second_shortest_B = 0 if shortest_B > 0 else 1
		total_B = total_if_all - R[second_shortest_B] + B[second_shortest_B]
		for point in xrange(0, len(points)):
			if point != shortest_A:
				candidate_A = total_if_all - R[point] + A[point]
				if total_A > candidate_A:
					second_shortest_A = point
					total_A = candidate_A
			if point != shortest_B:
				candidate_B = total_if_all - R[point] + B[point]
				if total_B > candidate_B:
					second_shortest_B = point
					total_B = candidate_B

		all_candidates = [
			total_A, total_B
		]
		if shortest_A != shortest_B:
			all_candidates.append(total_if_all - R[shortest_A] + A[shortest_A] - R[shortest_B] + B[shortest_B])
		else:
			all_candidates.append(total_if_all - R[shortest_A] + A[shortest_A] - R[second_shortest_B] + B[second_shortest_B])
			all_candidates.append(total_if_all - R[second_shortest_A] + A[second_shortest_A] - R[shortest_B] + B[shortest_B])
		return min(all_candidates)

line = raw_input().strip().split()

pos_A = (int(line[0]), int(line[1]))
pos_B = (int(line[2]), int(line[3]))
R = (int(line[4]), int(line[5]))

#cases when either of them don't walk at all

total_points = int(raw_input())
points = []
for _ in xrange(total_points):
	line = raw_input().split()
	points.append((int(line[0]), int(line[1])))

from_recycle_to_points = []

for _ in xrange(total_points):
	dist = dist_points(points[_], R)
	from_recycle_to_points.append(dist)

from_A_to_points = []

for _ in xrange(total_points):
	dist = dist_points(points[_], pos_A)
	from_A_to_points.append(dist)

from_B_to_points = []

for _ in xrange(total_points):
	dist = dist_points(points[_], pos_B)
	from_B_to_points.append(dist)

total_if_all = 0

for el in from_recycle_to_points:
	total_if_all += 2*el

print solution(points, from_A_to_points, from_B_to_points, from_recycle_to_points, total_if_all)


ax,ay,bx,by,tx,ty = map(int,raw_input().split())
n = input()

store = []
ans = 0

amax  = -1e10
amax2 = -1e10

amaxpt = None
amaxpt2 = None

bmax  = -1e10
bmax2 = -1e10

bmaxpt = None
bmaxpt2 = None

for _ in range(n):
    x,y = map(int,raw_input().split())
    store.append([x,y])

    g =((tx-x) ** 2 + (ty-y) ** 2) ** 0.5
    ans += g

    adist = g  -  ((ax-x) ** 2 + (ay-y) ** 2) ** 0.5

    if adist >= amax:
        amax2 = amax
        amaxpt2 = amaxpt

        amax = adist
        amaxpt = x,y

    elif adist >= amax2:
        amax2 = adist
        amaxpt2 = x,y

    bdist = g  -  ((bx-x) ** 2 + (by-y) ** 2) ** 0.5

    if bdist >= bmax:
        bmax2 = bmax
        bmaxpt2 = bmaxpt

        bmax = bdist
        bmaxpt = x,y

    elif adist >= amax2:
        bmax2 = bdist
        bmaxpt2 = x,y

ans = ans * 2

if n == 1:
    print ans - max(amax,bmax)

else:
    #print ans,amax,bmax,amax2,bmax2
    if amaxpt != bmaxpt:
        print ans - max(amax,bmax,amax+bmax)
    else:
        print ans - max(amax+bmax2,amax2+bmax,amax,bmax)


ax,ay,bx,by,tx,ty = map(int,raw_input().split())
n = input()

store = []
ans = 0

amax  = -1e10
amax2 = -1e10

amaxpt = None
amaxpt2 = None

bmax  = -1e10
bmax2 = -1e10

bmaxpt = None
bmaxpt2 = None

for _ in range(n):
    x,y = map(int,raw_input().split())
    store.append([x,y])

    g =((tx-x) ** 2 + (ty-y) ** 2) ** 0.5
    ans += g

    adist = g  -  ((ax-x) ** 2 + (ay-y) ** 2) ** 0.5

    if adist >= amax:
        amax2 = amax
        amaxpt2 = amaxpt

        amax = adist
        amaxpt = x,y

    elif adist >= amax2:
        amax2 = adist
        amaxpt2 = x,y

    bdist = g  -  ((bx-x) ** 2 + (by-y) ** 2) ** 0.5

    if bdist >= bmax:
        bmax2 = bmax
        bmaxpt2 = bmaxpt

        bmax = bdist
        bmaxpt = x,y

    elif adist >= amax2:
        bmax2 = bdist
        bmaxpt2 = x,y

ans = ans * 2

if n == 1:
    print ans - max(amax,bmax)

else:
    #print ans,amax,bmax,amax2,bmax2
    if amaxpt != bmaxpt:
        if amax >= 0 and bmax >= 0:
            print ans - (amax + bmax)
        elif amax >= 0:
            print ans - amax
        elif bmax >= 0:
            print ans - bmax
        else:
            print ans - max(amax,bmax)

    else:
        if amax >= 0 and bmax >= 0:
            print ans - max(amax+bmax2,amax2+bmax)
        elif amax >= 0:
            print ans - amax
        elif bmax >= 0:
            print ans - bmax
        else:
            print ans - max(amax,bmax)


ax,ay,bx,by,tx,ty = map(int,raw_input().split())
n = input()

store = []
ans = 0

amax  = -1e10
amax2 = -1e10

amaxpt = None
amaxpt2 = None

bmax  = -1e10
bmax2 = -1e10

bmaxpt = None
bmaxpt2 = None

for _ in range(n):
    x,y = map(int,raw_input().split())
    store.append([x,y])

    g =((tx-x) ** 2 + (ty-y) ** 2) ** 0.5
    ans += g

    adist = g  -  ((ax-x) ** 2 + (ay-y) ** 2) ** 0.5

    if adist >= amax:
        amax2 = amax
        amaxpt2 = amaxpt

        amax = adist
        amaxpt = x,y

    elif adist >= amax2:
        amax2 = adist
        amaxpt2 = x,y

    bdist = g  -  ((bx-x) ** 2 + (by-y) ** 2) ** 0.5

    if bdist >= bmax:
        bmax2 = bmax
        bmaxpt2 = bmaxpt

        bmax = bdist
        bmaxpt = x,y

    elif bdist >= bmax2:
        bmax2 = bdist
        bmaxpt2 = x,y

ans = ans * 2

if n == 1:
    print ans - max(amax,bmax)

else:
    #print ans,amax,bmax,amax2,bmax2
    if amaxpt != bmaxpt:
        print ans - max(amax,bmax,amax+bmax)
    else:
        print ans - max(amax+bmax2,amax2+bmax,amax,bmax)


ax,ay,bx,by,tx,ty = map(int,raw_input().split())
n = input()

store = []
ans = 0

amax  = -1e10
amax2 = -1e10

amaxpt = None
amaxpt2 = None

bmax  = -1e10
bmax2 = -1e10

bmaxpt = None
bmaxpt2 = None

for _ in range(n):
    x,y = map(int,raw_input().split())
    store.append([x,y])

    g =((tx-x) ** 2 + (ty-y) ** 2) ** 0.5
    ans += g

    adist = g  -  ((ax-x) ** 2 + (ay-y) ** 2) ** 0.5

    if adist >= amax:
        amax2 = amax
        amaxpt2 = amaxpt

        amax = adist
        amaxpt = x,y

    elif adist >= amax2:
        amax2 = adist
        amaxpt2 = x,y

    bdist = g  -  ((bx-x) ** 2 + (by-y) ** 2) ** 0.5

    if bdist >= bmax:
        bmax2 = bmax
        bmaxpt2 = bmaxpt

        bmax = bdist
        bmaxpt = x,y

    elif adist >= amax2:
        bmax2 = bdist
        bmaxpt2 = x,y

ans = ans * 2

if n == 1:
    print ans - max(amax,bmax)

else:
    #print ans,amax,bmax,amax2,bmax2
    if amaxpt != bmaxpt:
        if amax >= 0 and bmax >= 0:
            print ans - (amax + bmax)
        elif amax >= 0:
            print ans - amax
        elif bmax >= 0:
            print ans - bmax
        else:
            print ans - max(amax,bmax)

    else:
        print ans - max(amax+bmax2,amax2+bmax,amax,bmax)


import math

def dist(x1, y1, x2, y2):
	return math.sqrt((x1-x2)**2 + (y1-y2)**2)

ax, ay, bx, by, tx, ty = [int(x) for x in raw_input().split()]
n = int(raw_input())

sum = float(0)
aopt = [(0.0, 0) for _ in range(0, n)]
bopt = [(0.0, 0) for _ in range(0, n)]

for i in range(0, n):
	xi, yi = [int(x) for x in raw_input().split()]

	dd = dist(tx, ty, xi, yi)
	sum += dd * 2

	aopt[i] = (dist(ax, ay, xi, yi) - dd, i)
	bopt[i] = (dist(bx, by, xi, yi) - dd, i)

aopt.sort()
bopt.sort()

mn = 1e20

for i in range(0, min(n, 3)):
	for j in range(0, min(n, 3)):
		if aopt[i][1] != bopt[j][1]:
			mn = min(mn, sum + aopt[i][0] + bopt[j][0])
for i in range(0, n):
	mn = min(mn, sum + min(aopt[i][0], bopt[i][0]))

print mn


import math

def dist(x1, y1, x2, y2):
	return math.sqrt((x1-x2)**2 + (y1-y2)**2)

ax, ay, bx, by, tx, ty = [int(x) for x in raw_input().split()]
n = int(raw_input())

sum = float(0)
aopt = [(0.0, 0) for _ in range(0, n)]
bopt = [(0.0, 0) for _ in range(0, n)]

for i in range(0, n):
	xi, yi = [int(x) for x in raw_input().split()]

	dd = dist(tx, ty, xi, yi)
	sum += dd * 2

	aopt[i] = (dist(ax, ay, xi, yi) - dd, i)
	bopt[i] = (dist(bx, by, xi, yi) - dd, i)

aopt.sort()
bopt.sort()

mn = 1e20

for i in range(0, min(n, 10)):
	for j in range(0, min(n, 10)):
		if aopt[i][1] == bopt[j][1]:
			mn = min(mn, sum + min(aopt[i][0], bopt[j][0]))
		else:
			mn = min(mn, sum + aopt[i][0] + bopt[j][0])

print mn


import math

def dist(x1, y1, x2, y2):
	return math.sqrt((x1-x2)**2 + (y1-y2)**2)

ax, ay, bx, by, tx, ty = [int(x) for x in raw_input().split()]
n = int(raw_input())

sum = float(0)
aopt = [(0.0, 0) for _ in range(0, n)]
bopt = [(0.0, 0) for _ in range(0, n)]

for i in range(0, n):
	xi, yi = [int(x) for x in raw_input().split()]

	dd = dist(tx, ty, xi, yi)
	sum += dd * 2

	aopt[i] = (dist(ax, ay, xi, yi) - dd, i)
	bopt[i] = (dist(bx, by, xi, yi) - dd, i)

aopt.sort()
bopt.sort()

mn = 1e20

for i in range(0, min(n, 2)):
	for j in range(0, min(n, 2)):
		if aopt[i][1] != bopt[j][1]:
			mn = min(mn, sum + aopt[i][0] + bopt[j][0])

mn = min(mn, sum + min(aopt[0][0], bopt[0][0]))

print mn


import math

def dist(x1, y1, x2, y2):
	return math.sqrt((x1-x2)**2 + (y1-y2)**2)

ax, ay, bx, by, tx, ty = [int(x) for x in raw_input().split()]
n = int(raw_input())

sum = float(0)
aopt = [(0.0, 0) for _ in range(0, n)]
bopt = [(0.0, 0) for _ in range(0, n)]

for i in range(0, n):
	xi, yi = [int(x) for x in raw_input().split()]

	dd = dist(tx, ty, xi, yi)
	sum += dd * 2

	aopt[i] = (dist(ax, ay, xi, yi) - dd, i)
	bopt[i] = (dist(bx, by, xi, yi) - dd, i)

aopt.sort()
bopt.sort()

mn = 1e20

print sum, aopt, bopt

for i in range(0, min(n, 10)):
	for j in range(0, min(n, 10)):
		if aopt[i][1] == bopt[j][1]:
			mn = min(mn, sum + min(aopt[i][0], bopt[j][0]))
		else:
			mn = min(mn, sum + aopt[i][0] + bopt[j][0])

print mn


import math

def dist(x1, y1, x2, y2):
	return math.sqrt((x1-x2)**2 + (y1-y2)**2)

ax, ay, bx, by, tx, ty = [int(x) for x in raw_input().split()]
n = int(raw_input())

sum = float(0)
aopt = [(0.0, 0) for _ in range(0, n)]
bopt = [(0.0, 0) for _ in range(0, n)]

for i in range(0, n):
	xi, yi = [int(x) for x in raw_input().split()]

	dd = dist(tx, ty, xi, yi)
	sum += dd * 2

	aopt[i] = (dist(ax, ay, xi, yi) - dd, i)
	bopt[i] = (dist(bx, by, xi, yi) - dd, i)

aopt.sort()
bopt.sort()

mn = 1e20

for i in range(0, min(n, 3)):
	for j in range(0, min(n, 3)):
		if aopt[i][1] != bopt[j][1]:
			mn = min(mn, sum + aopt[i][0] + bopt[j][0])
for i in range(0, n):
	mn = min(mn, sum + min(aopt[i][0], bopt[j][0]))

print mn


import math

def dist(x1, y1, x2, y2):
	return math.sqrt((x1-x2)**2 + (y1-y2)**2)

ax, ay, bx, by, tx, ty = [int(x) for x in raw_input().split()]
n = int(raw_input())

sum = float(0)
aopt = [(0.0, 0) for _ in range(0, n)]
bopt = [(0.0, 0) for _ in range(0, n)]

for i in range(0, n):
	xi, yi = [int(x) for x in raw_input().split()]

	dd = dist(tx, ty, xi, yi)
	sum += dd * 2

	aopt[i] = (dist(ax, ay, xi, yi) - dd, i)
	bopt[i] = (dist(bx, by, xi, yi) - dd, i)

aopt.sort()
bopt.sort()

mn = 1e20

for i in range(0, min(n, 3)):
	for j in range(0, min(n, 3)):
		if aopt[i][1] != bopt[j][1]:
			mn = min(mn, sum + aopt[i][0] + bopt[j][0])
		else:
			mn = min(mn, sum + min(aopt[i][0], bopt[i][0]))
#for i in range(0, n):
#	mn = min(mn, sum + min(aopt[i][0], bopt[i][0]))

print mn


ax, ay, bx, by, tx, ty = map(int, raw_input().split())
n = input()
XY = [map(int, raw_input().split()) for _ in xrange(n)]

def dist2(x, y, p, q):
    return (x-p)*(x-p) + (y-q)*(y-q)

def dist(x, y, p, q):
    return dist2(x, y, p, q)**0.5

def calc(dist_a, dist_b, dist_t):
    ans = 0
    da2, ia = dist_a[0]
    # print '> A point is (%d, %d)' % (XY[ia][0], XY[ia][1])
    flag = False
    for i, (x, y) in enumerate(XY):
        # print 'Look for point (%d, %d)' % (x, y)
        d2 = dist2(tx, ty, x, y)
        if i == ia and d2 > da2:
            tmp = d2**0.5 + da2**0.5
            ans += tmp
            # print 'da=%s < dt=%s, add %s' % (da2**0.5, d2**0.5, tmp)
            flag = True
        else:
            # print 'Just add %s' % (2 * d2**0.5)
            ans += 2 * d2**0.5
    # print 'flag %s' % flag
    if not flag:
        ans -= dist_t[-1][0]**0.5
        ans += da2**0.5
    else:
        # for i in xrange(n-1, -1, -1):
        best = 0
        for i in xrange(n):
            db2, ib = dist_b[i]
            x, y = XY[ib]
            d2 = dist2(tx, ty, x, y)
            if d2 > db2 and ib != ia:
                tmp = d2**0.5 + db2**0.5
                # print 'x=%d, y=%d: db=%s < dt=%s, add %s, remove %s' % (x, y, db2**0.5, d2**0.5, tmp, 2*d2**0.5)
                best = min(best, tmp - 2*d2**0.5)
                # ans -= 2 * d2**0.5
                # ans += tmp
        ans += best
    # print ans
    return ans

# dist_a = sorted((dist2(ax, ay, x, y), i) for i, (x, y) in enumerate(XY))
dist_b = sorted((dist(bx, by, x, y) - dist(tx, ty, x, y), i) for i, (x, y) in enumerate(XY))
# dist_t = sorted((dist2(tx, ty, x, y), i) for i, (x, y) in enumerate(XY))

T = 2*sum(dist(tx, ty, x, y) for x, y in XY)
ans = 10 ** 18
for i in xrange(n):
    x, y = XY[i]
    dt = dist(tx, ty, x, y)

    da = dist(ax, ay, x, y)
    tmp = T + da - dt
    ans = min(ans, tmp)

    for dbt, j in dist_b:
        if j != i:
            tmp = T + da - dt + dbt
            ans = min(ans, tmp)
            break

    db = dist2(bx, by, x, y)
    tmp = T + db**0.5 - dt**0.5
    ans = min(ans, tmp)

# ans = min(calc(dist_a, dist_b, dist_t), calc(dist_b, dist_a, dist_t))
print ans


ax, ay, bx, by, tx, ty = map(int, raw_input().split())
n = input()
XY = [map(int, raw_input().split()) for _ in xrange(n)]

def dist2(x, y, p, q):
    return (x-p)*(x-p) + (y-q)*(y-q)

def dist(x, y, p, q):
    return dist2(x, y, p, q)**0.5

def solve(da, db, origin_dist):
    n = len(origin_dist)
    visited = [False] * n
    ans = 0

    p0 = None
    i = 0
    ia = 0
    while i < n:
        p0, i0 = origin_dist[i]
        if visited[i0]:
            i += 1
            continue
        print 'p0, i0', p0, i0
        if ia > 0:
            print 'O:', p0, i0
            ans += 2 * p0**0.5
            visited[i0] = True
            i += 1
            print ans
            continue

        p1, i1 = da[ia]
        if p0 < p1:
            print 'O', p0, i0
            ans += 2 * p0**0.5
            visited[i0] = True
            i += 1
            print ans
        else:
            x, y = XY[i1]
            print 'A:', p1, i1, 'x, y =', x, y
            ans += p1**0.5 + dist(x, y, tx, ty)
            visited[i1] = True
            ia = 1
            print ans

    if not ia:
        ans -= p0 ** 0.5
        ans += da[0][0]**0.5

    ib = 0
    while i < n:
        p0, i0 = origin_dist[i]
        if visited[i0]:
            i += 1
            continue
        if ib > 0:
            print p0, i0
            ans += 2 * p0**0.5
            visited[i0] = True
            i += 1
            print ans
            continue

        p1, i1 = db[ib]
        if p0 < p1:
            print p0, i0
            ans += 2 * p0**0.5
            visited[i0] = True
            i += 1
            print ans
        else:
            print 'B:', p1, i1
            ans += p0**0.5 + p1**0.5
            visited[i1] = True
            ib = 1
            print ans

    print 'Result:', ans
    return ans

def calc(dist_a, dist_b, dist_t):
    ans = 0
    da2, ia = dist_a[0]
    # print '> A point is (%d, %d)' % (XY[ia][0], XY[ia][1])
    flag = False
    for i, (x, y) in enumerate(XY):
        # print 'Look for point (%d, %d)' % (x, y)
        d2 = dist2(tx, ty, x, y)
        if i == ia and d2 > da2:
            tmp = d2**0.5 + da2**0.5
            ans += tmp
            # print 'da=%s < dt=%s, add %s' % (da2**0.5, d2**0.5, tmp)
            flag = True
        else:
            # print 'Just add %s' % (2 * d2**0.5)
            ans += 2 * d2**0.5
    # print 'flag %s' % flag
    if not flag:
        ans -= dist_t[-1][0]**0.5
        ans += da2**0.5
    else:
        # for i in xrange(n-1, -1, -1):
        best = 0
        for i in xrange(n):
            db2, ib = dist_b[i]
            x, y = XY[ib]
            d2 = dist2(tx, ty, x, y)
            if d2 > db2 and ib != ia:
                tmp = d2**0.5 + db2**0.5
                # print 'x=%d, y=%d: db=%s < dt=%s, add %s, remove %s' % (x, y, db2**0.5, d2**0.5, tmp, 2*d2**0.5)
                best = min(best, tmp - 2*d2**0.5)
                # ans -= 2 * d2**0.5
                # ans += tmp
        ans += best
    # print ans
    return ans

dist_a = sorted([(dist2(ax, ay, x, y), i) for i, (x, y) in enumerate(XY)])
dist_b = sorted([(dist2(bx, by, x, y), i) for i, (x, y) in enumerate(XY)])
dist_t = sorted([(dist2(tx, ty, x, y), i) for i, (x, y) in enumerate(XY)])

ans = min(calc(dist_a, dist_b, dist_t), calc(dist_b, dist_a, dist_t))
print ans


ax, ay, bx, by, tx, ty = map(int, raw_input().split())
n = input()
XY = [map(int, raw_input().split()) for _ in xrange(n)]

def dist2(x, y, p, q):
    return (x-p)*(x-p) + (y-q)*(y-q)

def dist(x, y, p, q):
    return dist2(x, y, p, q)**0.5

def calc(dist_a, dist_b, dist_t):
    ans = 0
    da2, ia = dist_a[0]
    # print '> A point is (%d, %d)' % (XY[ia][0], XY[ia][1])
    flag = False
    for i, (x, y) in enumerate(XY):
        # print 'Look for point (%d, %d)' % (x, y)
        d2 = dist2(tx, ty, x, y)
        if i == ia and d2 > da2:
            tmp = d2**0.5 + da2**0.5
            ans += tmp
            # print 'da=%s < dt=%s, add %s' % (da2**0.5, d2**0.5, tmp)
            flag = True
        else:
            # print 'Just add %s' % (2 * d2**0.5)
            ans += 2 * d2**0.5
    # print 'flag %s' % flag
    if not flag:
        ans -= dist_t[-1][0]**0.5
        ans += da2**0.5
    else:
        # for i in xrange(n-1, -1, -1):
        best = 0
        for i in xrange(n):
            db2, ib = dist_b[i]
            x, y = XY[ib]
            d2 = dist2(tx, ty, x, y)
            if d2 > db2 and ib != ia:
                tmp = d2**0.5 + db2**0.5
                # print 'x=%d, y=%d: db=%s < dt=%s, add %s, remove %s' % (x, y, db2**0.5, d2**0.5, tmp, 2*d2**0.5)
                best = min(best, tmp - 2*d2**0.5)
                # ans -= 2 * d2**0.5
                # ans += tmp
        ans += best
    # print ans
    return ans

# dist_a = sorted((dist2(ax, ay, x, y), i) for i, (x, y) in enumerate(XY))
dist_b = sorted((dist(bx, by, x, y) - dist(tx, ty, x, y), i) for i, (x, y) in enumerate(XY))
# dist_t = sorted((dist2(tx, ty, x, y), i) for i, (x, y) in enumerate(XY))

T = 2*sum(dist(tx, ty, x, y) for x, y in XY)
ans = 10 ** 18
for i in xrange(n):
    x, y = XY[i]
    dt = dist(tx, ty, x, y)

    da = dist(ax, ay, x, y)
    tmp = T + da - dt
    ans = min(ans, tmp)

    for dbt, j in dist_b:
        if j != i:
            tmp = T + da - dt + dbt
            ans = min(ans, tmp)
            break

    db = dist(bx, by, x, y)
    tmp = T + db - dt
    ans = min(ans, tmp)

# ans = min(calc(dist_a, dist_b, dist_t), calc(dist_b, dist_a, dist_t))
print ans


import sys
from math import sqrt

def distance(x,y,a,b):
	return sqrt((a-x)**2+(b-y)**2)

ax,ay,bx,by,cx,cy = map(int,raw_input().split())
n = int(raw_input())
a = sys.stdin.read()

trashL = a.splitlines()
trashL = [map(int,x.split()) for x in trashL]
ans = 0

aL = [None,None,None,None]
bL = [None,None,None,None] #first two dis, second two id
for xy in trashL:
	cxy = distance(cx,cy,xy[0],xy[1])
	axy = distance(ax,ay,xy[0],xy[1])
	bxy = distance(bx,by,xy[0],xy[1])
	ans += 2*cxy
	ac = -axy+cxy
	bc = -bxy+cxy
	#print ac,bc
	#print aL,bL
	#print
	#print ac,bc,aL,bL
	if ac > aL[0]:
		aL[2] = aL[0]
		aL[3] = aL[1]
		aL[0] = ac
		aL[1] = xy
	elif ac>aL[2]:
		aL[2] = ac
		aL[3] = xy
	if bc > bL[0]:
		bL[2] = bL[0]
		bL[3] = bL[1]
		bL[0] = bc
		bL[1] = xy
	elif bc>bL[2]:
		bL[2] = bc
		bL[3] = xy
#print ans
#print aL,bL
if aL[0] > 0 and bL[0] > 0:
	if aL[1] != bL[1]:
		ans-=aL[0]
		ans-=bL[0]
	else:
		#print ans
		a1 = aL[0]+max(bL[2],0)
		a2 = bL[0]+max(aL[2],0)
		#print a1,a2
		ans-=max(a1,a2)
		#print ans
		'''
		if aL[0] > bL[0]:
			#print aL[0]
			ans-=aL[0]
			#print bL[2]
			ans-=max(0,bL[2])
		elif aL[0] < bL[0]:
			#print bL[1],aL[3]
			ans-=bL[0]
			ans-=max(0,aL[2])
		else:
			if aL[2]>=bL[2]:
				ans-=bL[0]
				ans-=max(0,aL[2])
			else:
				ans-=aL[0]
				ans-=max(0,bL[2])
		'''
elif aL[0]>0:
	ans -= aL[0]
elif bL[0]>0:
	ans -= bL[0]
else:
	#aL[0]=<0 and bL[0]=<0
	ans -= max(aL[0],bL[0])
print ans


import sys
from math import sqrt

def distance(x,y,a,b):
	return sqrt((a-x)**2+(b-y)**2)

ax,ay,bx,by,cx,cy = map(int,raw_input().split())
n = int(raw_input())
a = sys.stdin.read()

trashL = a.splitlines()
trashL = [map(int,x.split()) for x in trashL]
ans = 0

aL = [None,None,None,None]
bL = [None,None,None,None] #first two dis, second two id
for xy in trashL:
	cxy = distance(cx,cy,xy[0],xy[1])
	axy = distance(ax,ay,xy[0],xy[1])
	bxy = distance(bx,by,xy[0],xy[1])
	ans += 2*cxy
	ac = -axy+cxy
	bc = -bxy+cxy
	#print ac,bc,aL,bL
	if ac > aL[0]:
		aL[2] = aL[0]
		aL[3] = aL[1]
		aL[0] = ac
		aL[1] = xy
	elif ac>aL[1]:
		aL[2] = ac
		aL[3] = xy
	if bc > bL[0]:
		bL[2] = bL[0]
		bL[3] = bL[1]
		bL[0] = bc
		bL[1] = xy
	elif bc>bL[1]:
		bL[2] = bc
		bL[3] = xy
#print aL,bL
if aL[0] > 0 and bL[0] > 0:
	if aL[2] != bL[2]:
		ans-=aL[0]
		ans-=bL[0]
	else:
		if aL[0] > bL[0]:
			ans-=aL[1]
			ans-=max(0,bL[2])
		elif aL[0] < bL[0]:
			ans-=bL[1]
			ans-=max(0,aL[2])
print ans


import sys
from math import sqrt

def distance(x,y,a,b):
	return sqrt((a-x)**2+(b-y)**2)

ax,ay,bx,by,cx,cy = map(int,raw_input().split())
n = int(raw_input())
a = sys.stdin.read()

trashL = a.splitlines()
trashL = [map(int,x.split()) for x in trashL]
ans = 0

aL = [None,None,None,None]
bL = [None,None,None,None] #first two dis, second two id
for xy in trashL:
	cxy = distance(cx,cy,xy[0],xy[1])
	axy = distance(ax,ay,xy[0],xy[1])
	bxy = distance(bx,by,xy[0],xy[1])
	ans += 2*cxy
	ac = -axy+cxy
	bc = -bxy+cxy
	#print ac,bc,aL,bL
	if ac > aL[0]:
		aL[2] = aL[0]
		aL[3] = aL[1]
		aL[0] = ac
		aL[1] = xy
	elif ac>aL[1]:
		aL[2] = ac
		aL[3] = xy
	if bc > bL[0]:
		bL[2] = bL[0]
		bL[3] = bL[1]
		bL[0] = bc
		bL[1] = xy
	elif bc>bL[1]:
		bL[2] = bc
		bL[3] = xy
#print ans
#print aL,bL
if aL[0] > 0 and bL[0] > 0:
	if aL[1] != bL[1]:
		ans-=aL[0]
		ans-=bL[0]
	else:
		a1 = aL[0]+max(bL[2],0)
		a2 = bL[0]+max(aL[2],0)
		ans-=max(a1,a2)
		'''
		if aL[0] > bL[0]:
			#print aL[0]
			ans-=aL[0]
			#print bL[2]
			ans-=max(0,bL[2])
		elif aL[0] < bL[0]:
			#print bL[1],aL[3]
			ans-=bL[0]
			ans-=max(0,aL[2])
		else:
			if aL[2]>=bL[2]:
				ans-=bL[0]
				ans-=max(0,aL[2])
			else:
				ans-=aL[0]
				ans-=max(0,bL[2])
		'''
elif aL[0]>0:
	ans -= aL[0]
elif bL[0]>0:
	ans -= bL[0]
else:
	#aL[0]=<0 and bL[0]=<0
	ans -= max(aL[0],bL[0])
print ans


import sys
from math import sqrt

def distance(x,y,a,b):
	return sqrt((a-x)**2+(b-y)**2)

ax,ay,bx,by,cx,cy = map(int,raw_input().split())
n = int(raw_input())
a = sys.stdin.read()

trashL = a.splitlines()
trashL = [map(int,x.split()) for x in trashL]
ans = 0

aL = [None,None,None,None]
bL = [None,None,None,None] #first two dis, second two id
for xy in trashL:
	cxy = distance(cx,cy,xy[0],xy[1])
	axy = distance(ax,ay,xy[0],xy[1])
	bxy = distance(bx,by,xy[0],xy[1])
	ans += 2*cxy
	ac = -axy+cxy
	bc = -bxy+cxy
	#print ac,bc,aL,bL
	if ac > aL[0]:
		aL[2] = aL[0]
		aL[3] = aL[1]
		aL[0] = ac
		aL[1] = xy
	elif ac>aL[1]:
		aL[2] = ac
		aL[3] = xy
	if bc > bL[0]:
		bL[2] = bL[0]
		bL[3] = bL[1]
		bL[0] = bc
		bL[1] = xy
	elif bc>bL[1]:
		bL[2] = bc
		bL[3] = xy
#print ans
#print aL,bL
if aL[0] > 0 and bL[0] > 0:
	if aL[1] != bL[1]:
		ans-=aL[0]
		ans-=bL[0]
	else:
		if aL[0] > bL[0]:
			#print aL[0]
			ans-=aL[0]
			#print bL[2]
			ans-=max(0,bL[2])
		elif aL[0] < bL[0]:
			#print bL[1],aL[3]
			ans-=bL[0]
			ans-=max(0,aL[2])
		else:
			if aL[2]>=bL[2]:
				ans-=aL[0]
				ans-=max(0,aL[2])
			else:
				ans-=aL[0]
				ans-=max(0,bL[2])
elif aL[0]>0:
	ans -= aL[0]
elif bL[0]>0:
	ans -= bL[0]
else:
	#aL[0]=<0 and bL[0]=<0
	ans -= max(aL[0],bL[0])
print ans


import math

def solve(ax, ay, bx, by, tx, ty, bottles):
	total = 0.0

	for i in bottles:
		total += 2 * math.sqrt((tx - i[0]) * (tx - i[0]) + (ty - i[1]) * (ty - i[1]))

	aBest = 1000000000000000000000000.0
	aBestItem = []
	aBest2 = 1000000000000000000000000.0
	aBest2Item = []
	bBest = 1000000000000000000000000.0
	bBestItem = []
	bBest2 = 1000000000000000000000000.0
	bBest2Item = []

	for i in bottles:
		subtractedDist = 2 * math.sqrt((tx - i[0]) * (tx - i[0]) + (ty - i[1]) * (ty - i[1]))
		distanceA = (total - subtractedDist) + math.sqrt((ax - i[0]) * (ax - i[0]) + (ay - i[1]) * (ay - i[1])) + math.sqrt((i[0] - tx) * (i[0] - tx) + (i[1] - ty) * (i[1] - ty))
		distanceB = (total - subtractedDist) + math.sqrt((bx - i[0]) * (bx - i[0]) + (by - i[1]) * (by - i[1])) + math.sqrt((i[0] - tx) * (i[0] - tx) + (i[1] - ty) * (i[1] - ty))

		if distanceA <= aBest:
			aBest2 = aBest
			aBest2Item = aBestItem
			aBest = distanceA
			aBestItem = i
		elif distanceA < aBest2:
			aBest2 = distanceA
			aBest2Item = i

		if distanceB <= bBest:
			bBest2 = bBest
			bBest2Item = bBestItem
			bBest = distanceB
			bBestItem = i
		elif distanceB < bBest2:
			bBest2 = distanceB
			bBest2Item = i

	possiblePath1 = aBest
	possiblePath2 = bBest
	possiblePath3 = (aBest + bBest) - total

	if aBestItem == bBestItem:
		if aBest + bBest2 < bBest + aBest2:
			possiblePath3 = (aBest + bBest2) - total
		else:
			possiblePath3 = (bBest + aBest2) - total

	return min(possiblePath1, possiblePath2, possiblePath3)

ax, ay, bx, by, tx, ty = map(int, raw_input().split())
n = int(raw_input())
bottles = [map(int, raw_input().split()) for i in range(n)]

print solve(ax, ay, bx, by, tx, ty, bottles)


import math

def euclid_dist(a, b):
    return math.sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]))

coords = map(int, raw_input().split())
a = (coords[0], coords[1])
b = (coords[2], coords[3])
trash = (coords[4], coords[5])

n = int(raw_input())
sum_distances = 0
savings_a = []
savings_b = []
for i in range(n):
    bottle = map(int, raw_input().split())
    distance_to_trash = 2 * euclid_dist(bottle, trash)
    sum_distances += distance_to_trash
    d_a = euclid_dist(a, bottle) + euclid_dist(bottle, trash)
    d_b = euclid_dist(b, bottle) + euclid_dist(bottle, trash)
    savings_a.append((distance_to_trash - d_a, i))
    savings_b.append((distance_to_trash - d_b, i))

savings_a.sort(reverse=True)
savings_b.sort(reverse=True)

if savings_a[0][1] != savings_b[0][1]:
    print sum_distances - savings_a[0][0] - savings_b[0][0]
elif n == 1:
    print sum_distances - max(savings_a[0][0], savings_b[0][0])
else:
    variant_a = sum_distances - savings_a[0][0] - savings_b[1][0]
    variant_b = sum_distances - savings_a[1][0] - savings_b[0][0]
    print min(variant_a, variant_b)


import math

def euclid_dist(a, b):
    return math.sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]))

coords = map(int, raw_input().split())
a = (coords[0], coords[1])
b = (coords[2], coords[3])
trash = (coords[4], coords[5])

n = int(raw_input())
sum_distances = 0
savings_a = []
savings_b = []
for i in range(n):
    bottle = map(int, raw_input().split())
    sum_distances += 2 * euclid_dist(bottle, trash)
    savings_a.append((euclid_dist(bottle, trash) - euclid_dist(a, bottle), i))
    savings_b.append((euclid_dist(bottle, trash) - euclid_dist(b, bottle), i))

savings_a.sort(reverse=True)
savings_b.sort(reverse=True)

if savings_a[0][1] != savings_b[0][1]:
    variant_a = sum_distances - savings_a[0][0] - max(0.0, savings_b[0][0])
    variant_b = sum_distances - savings_b[0][0] - max(0.0, savings_a[0][0])
    print min(variant_a, variant_b)
elif n == 1:
    print sum_distances - max(savings_a[0][0], savings_b[0][0])
else:
    variant_a = sum_distances - savings_a[0][0] - max(0.0, savings_b[1][0])
    variant_b = sum_distances - savings_b[0][0] - max(0.0, savings_a[1][0])
    print min(variant_a, variant_b)


def dist(c1, c2):
    dx, dy = c1[0]-c2[0], c1[1]-c2[1]
    return (dx*dx+dy*dy)**0.5

ax, ay, bx, by, tx, ty = map(float, raw_input().split())
a = [ax, ay]
b = [bx, by]
t = [tx, ty]

n = int(raw_input())
ans = 0.0
A = []
for i in xrange(n):
    A.append(map(float, raw_input().split()) + [i])

def trans(A, c):
    return map(lambda v: [dist(v, c)-dist(v, t), v[2]], A)

if n == 1:
    ans = min(dist(A[0], a), dist(A[0], b)) + dist(v, t)
else:
    TA = sorted(trans(A, a))
    TB = sorted(trans(A, b))
    mins = 1e18
    for i in xrange(n):
        cv = TB[i][0]
        if TA[0][1] == TB[i][1]:
            cv += min(0.0, TA[1][0])
        else:
            cv += min(0.0, TA[0][0])
        mins = min(cv, mins)
    for i in xrange(n):
        cv = TA[i][0]
        if TB[0][1] == TA[i][1]:
            cv += min(0.0, TB[1][0])
        else:
            cv += min(0.0, TB[0][0])
        mins = min(cv, mins)
    ans = 2*sum(map(lambda v: dist(v, t), A)) + mins #+ amin[0] + bmin[0]

print '%.15f' % ans


def dist(c1, c2):
    dx, dy = c1[0]-c2[0], c1[1]-c2[1]
    return (dx*dx+dy*dy)**0.5

ax, ay, bx, by, tx, ty = map(float, raw_input().split())
a = [ax, ay]
b = [bx, by]
t = [tx, ty]

n = int(raw_input())
ans = 0.0
A = []
for i in xrange(n):
    A.append(map(float, raw_input().split()) + [i])

def trans(A, c):
    return map(lambda v: [dist(v, c)-dist(v, t), v[2]], A)

if n == 1:
    ans = min(dist(A[0], a), dist(A[0], b)) + dist(A[0], t)
else:
    TA = sorted(trans(A, a))
    TB = sorted(trans(A, b))
    mins = 1e18
    for i in xrange(n):
        cv = TB[i][0]
        if TA[0][1] == TB[i][1]:
            cv += min(0.0, TA[1][0])
        else:
            cv += min(0.0, TA[0][0])
        mins = min(cv, mins)
    for i in xrange(n):
        cv = TA[i][0]
        if TB[0][1] == TA[i][1]:
            cv += min(0.0, TB[1][0])
        else:
            cv += min(0.0, TB[0][0])
        mins = min(cv, mins)
    ans = 2*sum(map(lambda v: dist(v, t), A)) + mins #+ amin[0] + bmin[0]

print '%.15f' % ans


def dist(c1, c2):
    dx, dy = c1[0]-c2[0], c1[1]-c2[1]
    return (dx*dx+dy*dy)**0.5

ax, ay, bx, by, tx, ty = map(float, raw_input().split())
a = [ax, ay]
b = [bx, by]
t = [tx, ty]

n = int(raw_input())
ans = 0.0
A = []
for i in xrange(n):
    A.append(map(float, raw_input().split()) + [i])

def trans(A, c):
    return map(lambda v: [dist(v, c)-dist(v, t), v[2]], A)

if n == 1:
    ans = min(dist(A[0], a), dist(A[0], b)) + dist(v, t)
else:
    TA = sorted(trans(A, a))
    TB = sorted(trans(A, b))
    amin = TA[0]
    bmin = TB[0]
    if amin[1] == bmin[1]:
        amin2 = TA[1]
        bmin2 = TB[1]
        if amin2[0] < bmin2[0]:
            amin = amin2
        else:
            bmin = bmin2
    if amin[0] > 0.0 and bmin[0] > 0.0:
        if amin[0] > bmin[0]:
            amin[0] = 0.0
        else:
            bmin[0] = 0.0
    else:
        amin[0] = min(0.0, amin[0])
        bmin[0] = min(0.0, bmin[0])
    ans = 2*sum(map(lambda v: dist(v, t), A)) + amin[0] + bmin[0]

print '%.15f' % ans


def dist(c1, c2):
    dx, dy = c1[0]-c2[0], c1[1]-c2[1]
    return (dx*dx+dy*dy)**0.5

ax, ay, bx, by, tx, ty = map(float, raw_input().split())
a = [ax, ay]
b = [bx, by]
t = [tx, ty]

n = int(raw_input())
ans = 0.0
A = []
for i in xrange(n):
    A.append(map(float, raw_input().split()) + [i])

def trans(A, c):
    return map(lambda v: [dist(v, c)-dist(v, t), v[2]], A)

if n == 1:
    ans = min(dist(A[0], a), dist(A[0], b)) + dist(v, t)
else:
    TA = sorted(trans(A, a))
    TB = sorted(trans(A, b))
    mins = 1e9
    for i in xrange(n):
        cv = TB[i][0]
        if TA[0][1] == TB[i][1]:
            cv += min(0.0, TA[1][0])
        else:
            cv += min(0.0, TA[0][0])
        mins = min(cv, mins)
    for i in xrange(n):
        cv = TA[i][0]
        if TB[0][1] == TA[i][1]:
            cv += min(0.0, TB[1][0])
        else:
            cv += min(0.0, TB[0][0])
        mins = min(cv, mins)
    ans = 2*sum(map(lambda v: dist(v, t), A)) + mins #+ amin[0] + bmin[0]

print '%.15f' % ans


def dist(c1, c2):
    dx, dy = c1[0]-c2[0], c1[1]-c2[1]
    return (dx*dx+dy*dy)**0.5

ax, ay, bx, by, tx, ty = map(float, raw_input().split())
a = [ax, ay]
b = [bx, by]
t = [tx, ty]

n = int(raw_input())
ans = 0.0
A = []
for i in xrange(n):
    A.append(map(float, raw_input().split()) + [i])

def trans(A, c):
    return map(lambda v: (dist(v, c)-dist(v, t), v[2]), A)

if n == 1:
    ans = min(dist(A[0], a), dist(A[0], b)) + dist(v, t)
else:
    TA = sorted(trans(A, a))
    TB = sorted(trans(A, b))
    mins = sorted([TA[0], TA[1], TB[0], TB[1]])
    if mins[0][1] == mins[1][1]:
        del mins[1]
    ans = 2*sum(map(lambda v: dist(v, t), A)) + mins[0][0] + mins[1][0]

print '%.15f' % ans


def dist(c1, c2):
    dx, dy = c1[0]-c2[0], c1[1]-c2[1]
    return (dx*dx+dy*dy)**0.5

ax, ay, bx, by, tx, ty = map(float, raw_input().split())
a = [ax, ay]
b = [bx, by]
t = [tx, ty]

n = int(raw_input())
ans = 0.0
A = []
for i in xrange(n):
    A.append(map(float, raw_input().split()) + [i])

def trans(A, c):
    return map(lambda v: [dist(v, c)-dist(v, t), v[2]], A)

if n == 1:
    ans = min(dist(A[0], a), dist(A[0], b)) + dist(v, t)
else:
    TA = sorted(trans(A, a))
    TB = sorted(trans(A, b))
    amin = TA[0]
    bmin = TB[0]
    if amin[1] == bmin[1]:
        amin2 = TA[1]
        bmin2 = TB[1]
        if amin2[0] < bmin2[0]:
            amin = amin2
        else:
            bmin = bmin2
    amin[0] = min(0.0, amin[0])
    bmin[0] = min(0.0, bmin[0])
    ans = 2*sum(map(lambda v: dist(v, t), A)) + amin[0] + bmin[0]

print '%.15f' % ans


def dist(c1, c2):
    dx, dy = c1[0]-c2[0], c1[1]-c2[1]
    return (dx*dx+dy*dy)**0.5

ax, ay, bx, by, tx, ty = map(float, raw_input().split())
a = [ax, ay]
b = [bx, by]
t = [tx, ty]

n = int(raw_input())
ans = 0.0
A = []
for i in xrange(n):
    A.append(map(float, raw_input().split()) + [i])

def trans(A, c):
    return map(lambda v: (dist(v, c)-dist(v, t), v[2]), A)

if n == 1:
    ans = min(dist(A[0], a), dist(A[0], b)) + dist(v, t)
else:
    TA = sorted(trans(A, a))
    TB = sorted(trans(A, b))
    amin = TA[0]
    bmin = TB[0]
    if amin[1] == bmin[1]:
        amin2 = TA[1]
        bmin2 = TB[1]
        if amin2[0] < bmin2[0]:
            amin = amin2
        else:
            bmin = bmin2
        if n == 33:
            print 'asdf'
    ans = 2*sum(map(lambda v: dist(v, t), A)) + amin[0] + bmin[0]

print '%.15f' % ans


import math

class Point(object):
    def __init__(self, x, y):
        self.x = x
        self.y = y

class Distance(object):
    def __init__(self, id,  d):
        self.d = d
        self.id = id
        self.sign = False

def compute_distance(a, b):
    return math.sqrt(abs(a.x - b.x) ** 2 + abs(a.y - b.y) ** 2)

def solve():
    ans = 0.0
    ax, ay, bx, by, tx, ty = map(int, raw_input().split())
    a = Point(ax, ay)
    b = Point(bx, by)
    t = Point(tx, ty)
    n = map(int, raw_input().split())[0]
    p = []
    for i in range(n):
        x, y = map(int, raw_input().split())
        p.append(Point(x, y))
    a_min_d = math.sqrt(abs(ax - p[0].x) ** 2 + abs(ay - p[0].y) ** 2)
    b_min_d = math.sqrt(abs(bx - p[0].x) ** 2 + abs(by - p[0].y) ** 2)
    a_min_id = 0
    b_min_id = 0
    for i in range(1, n):
        d = compute_distance(a, p[i])
        if d < a_min_d:
            a_min_d = d
            a_min_id = i
        d = compute_distance(b, p[i])
        if d < b_min_d:
            b_min_d = d
            b_min_id = i
    if a_min_d > b_min_d:
        a, b = b, a
        a_min_id, b_min_id = b_min_id, a_min_id
        a_min_d, b_min_d = b_min_d, a_min_d
    ans += a_min_d
    ans += compute_distance(p[a_min_id], t)
    p.remove(p[a_min_id])
    b_dis = []
    t_dis = []
    for i in range(n - 1):
        c = Distance(i, compute_distance(b, p[i]))
        b_dis.append(c)
        c = Distance(i, compute_distance(t, p[i]))
        t_dis.append(c)
    b_dis.sort(key=lambda k : k.d, reverse=True)
    t_dis.sort(key=lambda k : k.d, reverse=True)
    sign_list = [False for i in range(n - 1)]
    b_index = 0
    t_index = 0
    while b_index < n - 1 and t_index < n - 1 and t_dis[t_index].d < b_dis[b_index].d:
        ans += 2.0 * t_dis[t_index].d
        sign_list[t_index] = True
        while b_index < n - 1 and sign_list[b_dis[b_index].id] is True:
            b_index += 1
        t_index += 1
    if b_index < n - 1:
        ans += b_dis[b_index].d
        ans += compute_distance(p[b_dis[b_index].id], t)
        sign_list[b_index] = True
        while t_index < n - 1:
            if sign_list[t_index] is False:
                ans += 2.0 * t_dis[t_index].d
            t_index += 1
    return ans

print solve()


import math

class Point(object):
    def __init__(self, x, y):
        self.x = x
        self.y = y

class Distance(object):
    def __init__(self, id,  d):
        self.d = d
        self.id = id
        self.sign = False

def compute_distance(a, b):
    return math.sqrt(abs(a.x - b.x) ** 2 + abs(a.y - b.y) ** 2)

def solve():
    ans = 0.0
    ax, ay, bx, by, tx, ty = map(int, raw_input().split())
    a = Point(ax, ay)
    b = Point(bx, by)
    t = Point(tx, ty)
    n = map(int, raw_input().split())[0]
    p = []
    for i in range(n):
        x, y = map(int, raw_input().split())
        p.append(Point(x, y))
    a_min_d = math.sqrt(abs(ax - p[0].x) ** 2 + abs(ay - p[0].y) ** 2)
    b_min_d = math.sqrt(abs(bx - p[0].x) ** 2 + abs(by - p[0].y) ** 2)
    a_min_id = 0
    b_min_id = 0
    for i in range(1, n):
        d = compute_distance(a, p[i])
        if d < a_min_d:
            a_min_d = d
            a_min_id = i
        d = compute_distance(b, p[i])
        if d < b_min_d:
            b_min_d = d
            b_min_id = i
    if a_min_d > b_min_d:
        a, b = b, a
        a_min_id, b_min_id = b_min_id, a_min_id
        a_min_d, b_min_d = b_min_d, a_min_d
    ans += a_min_d
    ans += compute_distance(p[a_min_id], t)
    p.remove(p[a_min_id])
    b_dis = []
    t_dis = []
    for i in range(n - 1):
        c = Distance(i, compute_distance(b, p[i]))
        b_dis.append(c)
        c = Distance(i, compute_distance(t, p[i]))
        t_dis.append(c)
    b_dis.sort(key=lambda k : k.d, reverse=False)
    t_dis.sort(key=lambda k : k.d, reverse=False)
    sign_list = [False for i in range(n - 1)]
    b_index = 0
    t_index = 0
    while b_index < n - 1 and t_index < n - 1 and t_dis[t_index].d < b_dis[b_index].d:
        ans += 2.0 * t_dis[t_index].d
        sign_list[t_index] = True
        while b_index < n - 1 and sign_list[b_dis[b_index].id] is True:
            b_index += 1
        t_index += 1
    if b_index < n - 1:
        ans += b_dis[b_index].d
        ans += compute_distance(p[b_dis[b_index].id], t)
        sign_list[b_index] = True
        while t_index < n - 1:
            if sign_list[t_index] is False:
                ans += 2.0 * t_dis[t_index].d
            t_index += 1
    return ans

print solve()


import math

class Point(object):
    def __init__(self, x, y):
        self.x = x
        self.y = y

def compute_distance(a, b):
    return math.sqrt(abs(a.x - b.x) ** 2 + abs(a.y - b.y) ** 2)

def solve():
    ax, ay, bx, by, tx, ty = map(int, raw_input().split())
    n = map(int, raw_input().split())[0]
    a = Point(ax, ay)
    b = Point(bx, by)
    t = Point(tx, ty)
    p = []
    for i in range(n):
        x, y = map(int, raw_input().split())
        p.append(Point(x, y))
    da = []
    db = []
    dt = []
    for point in p:
        da.append(compute_distance(a, point))
        db.append(compute_distance(b, point))
        dt.append(compute_distance(t, point))
    at_min = da[0] - dt[0]
    at_min_index = 0
    bt_min = db[0] - dt[0]
    bt_min_index = 0
    for i in range(1, len(dt)):
        if at_min > da[i] - dt[i]:
            at_min = da[i] - dt[i]
            at_min_index = i
        if bt_min > db[i] - dt[i]:
            bt_min = db[i] - dt[i]
            bt_min_index = i
    ans = min(sum(dt) * 2 + at_min, sum(dt) * 2 + bt_min)
    if at_min_index is not bt_min_index:
        ans = min(sum(dt) * 2 + at_min + bt_min, ans)
    elif len(dt) is 1:
        ans = min(sum(dt) * 2 + min(at_min, bt_min), ans)
    else:
        at_min2 = da[0] - dt[0]
        at_min2_index = 0
        if at_min_index is 0:
            at_min2 = da[1] - dt[1]
            at_min2_index = 1

        bt_min2 = db[0] - dt[0]
        bt_min2_index = 0
        if bt_min_index is 0:
            bt_min2 = db[1] - dt[1]
            bt_min2_index = 1

        for i in range(len(dt)):
            if i is not at_min_index:
                if at_min2 > da[i] - dt[i]:
                    at_min2 = da[i] - dt[i]
                    at_min2_index = i
                if bt_min2 > db[i] - dt[i]:
                    bt_min2 = db[i] - dt[i]
                    bt_min2_index = i
        return min(sum(dt) * 2 + min(at_min + bt_min2, at_min2 + bt_min, at_min2 + bt_min2), ans)

print solve()


import math

class Point(object):
    def __init__(self, x, y):
        self.x = x
        self.y = y

def compute_distance(a, b):
    return math.sqrt(abs(a.x - b.x) ** 2 + abs(a.y - b.y) ** 2)

def solve():
    ax, ay, bx, by, tx, ty = map(int, raw_input().split())
    n = map(int, raw_input().split())[0]
    a = Point(ax, ay)
    b = Point(bx, by)
    t = Point(tx, ty)
    p = []
    for i in range(n):
        x, y = map(int, raw_input().split())
        p.append(Point(x, y))
    da = []
    db = []
    dt = []
    for point in p:
        da.append(compute_distance(a, point))
        db.append(compute_distance(b, point))
        dt.append(compute_distance(t, point))
    at_min = da[0] - dt[0]
    at_min_index = 0
    bt_min = db[0] - dt[0]
    bt_min_index = 0
    for i in range(1, len(dt)):
        if at_min > da[i] - dt[i]:
            at_min = da[i] - dt[i]
            at_min_index = i
        if bt_min > db[i] - dt[i]:
            bt_min = db[i] - dt[i]
            bt_min_index = i
    if at_min_index is not bt_min_index:
        return sum(dt) * 2 + at_min + bt_min
    elif len(dt) is 1:
        return sum(dt) * 2 + min(at_min, bt_min)
    else:
        at_min2 = da[0] - dt[0]
        at_min2_index = 0
        if at_min_index is 0:
            at_min2 = da[1] - dt[1]
            at_min2_index = 1

        bt_min2 = db[0] - dt[0]
        bt_min2_index = 0
        if bt_min_index is 0:
            bt_min2 = db[1] - dt[1]
            bt_min2_index = 1

        for i in range(len(dt)):
            if i is not at_min_index:
                if at_min2 > da[i] - dt[i]:
                    at_min2 = da[i] - dt[i]
                    at_min2_index = i
                if bt_min2 > db[i] - dt[i]:
                    bt_min2 = db[i] - dt[i]
                    bt_min2_index = i
        return sum(dt) * 2 + min(at_min + bt_min2, at_min2 + bt_min)

print solve()


import math

class Point(object):
    def __init__(self, x, y):
        self.x = x
        self.y = y

class Distance(object):
    def __init__(self, id,  d):
        self.d = d
        self.id = id
        self.sign = False

def compute_distance(a, b):
    return math.sqrt(abs(a.x - b.x) ** 2 + abs(a.y - b.y) ** 2)

def solve():
    ans = 0.0
    ax, ay, bx, by, tx, ty = map(int, raw_input().split())
    a = Point(ax, ay)
    b = Point(bx, by)
    t = Point(tx, ty)
    n = map(int, raw_input().split())[0]
    p = []
    for i in range(n):
        x, y = map(int, raw_input().split())
        p.append(Point(x, y))
    a_min_d = math.sqrt(abs(ax - p[0].x) ** 2 + abs(ay - p[0].y) ** 2)
    b_min_d = math.sqrt(abs(bx - p[0].x) ** 2 + abs(by - p[0].y) ** 2)
    a_min_id = 0
    b_min_id = 0
    for i in range(1, n):
        d = compute_distance(a, p[i])
        if d < a_min_d:
            a_min_d = d
            a_min_id = i
        d = compute_distance(b, p[i])
        if d < b_min_d:
            b_min_d = d
            b_min_id = i
    if a_min_d < b_min_d:
        a, b = b, a
        a_min_id, b_min_id = b_min_id, a_min_id
        a_min_d, b_min_d = b_min_d, a_min_d
    ans += a_min_d
    ans += compute_distance(p[a_min_id], t)
    p.remove(p[a_min_id])
    b_dis = []
    t_dis = []
    for i in range(n - 1):
        c = Distance(i, compute_distance(b, p[i]))
        b_dis.append(c)
        c = Distance(i, compute_distance(t, p[i]))
        t_dis.append(c)
    b_dis.sort(key=lambda k : k.d, reverse=True)
    t_dis.sort(key=lambda k : k.d, reverse=True)
    sign_list = [False for i in range(n - 1)]
    b_index = 0
    t_index = 0
    while b_index < n - 1 and t_index < n - 1 and t_dis[t_index].d < b_dis[b_index].d:
        ans += 2.0 * t_dis[t_index].d
        sign_list[t_index] = True
        while b_index < n - 1 and sign_list[b_dis[b_index].id] is True:
            b_index += 1
        t_index += 1
    if b_index < n - 1:
        ans += b_dis[b_index].d
        ans += compute_distance(p[b_dis[b_index].id], t)
        sign_list[b_index] = True
        while t_index < n - 1:
            if sign_list[t_index] is False:
                ans += 2.0 * t_dis[t_index].d
            t_index += 1
    return ans

print solve()


import math

class Point(object):
    def __init__(self, x, y):
        self.x = x
        self.y = y

def compute_distance(a, b):
    return math.sqrt(abs(a.x - b.x) ** 2 + abs(a.y - b.y) ** 2)

def solve():
    ax, ay, bx, by, tx, ty = map(int, raw_input().split())
    n = map(int, raw_input().split())[0]
    a = Point(ax, ay)
    b = Point(bx, by)
    t = Point(tx, ty)
    p = []
    for i in range(n):
        x, y = map(int, raw_input().split())
        p.append(Point(x, y))
    da = []
    db = []
    dt = []
    for point in p:
        da.append(compute_distance(a, point))
        db.append(compute_distance(b, point))
        dt.append(compute_distance(t, point))
    at_min = da[0] - dt[0]
    at_min_index = 0
    bt_min = db[0] - dt[0]
    bt_min_index = 0
    for i in range(1, len(dt)):
        if at_min > da[i] - dt[i]:
            at_min = da[i] - dt[i]
            at_min_index = i
        if bt_min > db[i] - dt[i]:
            bt_min = db[i] - dt[i]
            bt_min_index = i
    ans = min(sum(dt) * 2 + at_min, sum(dt) * 2 + bt_min)
    if at_min_index is not bt_min_index:
        ans = min(sum(dt) * 2 + at_min + bt_min, ans)
    elif len(dt) is 1:
        ans = min(sum(dt) * 2 + min(at_min, bt_min), ans)
    else:
        at_min2 = da[0] - dt[0]
        at_min2_index = 0
        if at_min_index is 0:
            at_min2 = da[1] - dt[1]
            at_min2_index = 1

        bt_min2 = db[0] - dt[0]
        bt_min2_index = 0
        if bt_min_index is 0:
            bt_min2 = db[1] - dt[1]
            bt_min2_index = 1

        for i in range(len(dt)):
            if i is not at_min_index:
                if at_min2 > da[i] - dt[i]:
                    at_min2 = da[i] - dt[i]
                    at_min2_index = i
                if bt_min2 > db[i] - dt[i]:
                    bt_min2 = db[i] - dt[i]
                    bt_min2_index = i
        ans = min(sum(dt) * 2 + min(at_min + bt_min2, at_min2 + bt_min, at_min2 + bt_min2), ans)
    return ans

print solve()


import math

class Point(object):
    def __init__(self, x, y):
        self.x = x
        self.y = y

class Distance(object):
    def __init__(self, id,  d):
        self.d = d
        self.id = id
        self.sign = False

def compute_distance(a, b):
    return math.sqrt(abs(a.x - b.x) ** 2 + abs(a.y - b.y) ** 2)

def solve():
    ans = 0.0
    ax, ay, bx, by, tx, ty = map(int, raw_input().split())
    a = Point(ax, ay)
    b = Point(bx, by)
    t = Point(tx, ty)
    n = map(int, raw_input().split())[0]
    p = []
    for i in range(n):
        x, y = map(int, raw_input().split())
        p.append(Point(x, y))
    a_min_d = math.sqrt(abs(ax - p[0].x) ** 2 + abs(ay - p[0].y) ** 2)
    b_min_d = math.sqrt(abs(bx - p[0].x) ** 2 + abs(by - p[0].y) ** 2)
    a_min_id = 0
    b_min_id = 0
    for i in range(1, n):
        d = compute_distance(a, p[i])
        if d < a_min_d:
            a_min_d = d
            a_min_id = i
        d = compute_distance(b, p[i])
        if d < b_min_d:
            b_min_d = d
            b_min_id = i
    if a_min_d > b_min_d:
        a, b = b, a
        a_min_id, b_min_id = b_min_id, a_min_id
        a_min_d, b_min_d = b_min_d, a_min_d
    ans += a_min_d
    ans += compute_distance(p[a_min_id], t)
    p.remove(p[a_min_id])
    b_dis = []
    t_dis = []
    for i in range(n - 1):
        c = Distance(i, compute_distance(b, p[i]))
        b_dis.append(c)
        c = Distance(i, compute_distance(t, p[i]))
        t_dis.append(c)
    b_dis.sort(key=lambda k : k.d, reverse=False)
    t_dis.sort(key=lambda k : k.d, reverse=False)
    sign_list = [False for i in range(n - 1)]
    b_index = 0
    t_index = 0
    while b_index < n - 1 and t_index < n - 1 and t_dis[t_index].d < b_dis[b_index].d:
        ans += 2.0 * t_dis[t_index].d
        sign_list[t_index] = True
        while b_index < n - 1 and sign_list[b_dis[b_index].id] is True:
            b_index += 1
        t_index += 1
    if b_index < n - 1:
        ans += b_dis[b_index].d
        sign_list[b_index] = True
        while t_index < n - 1:
            if sign_list[t_index] is False:
                ans += 2.0 * t_dis[t_index].d
            t_index += 1
    return ans

print solve()


#include <stdio.h>
#include <math.h>

int ax,ay,bx,by,tx,ty;

long double distt(long,long);
long double dista(long,long);
long double distb(long,long);
long double max(long double, long double);
main()
{
	extern int ax,ay,bx,by,tx,ty;
	int i,x,y, ai, bi;
	long n, asave, bsave;
	scanf("%d %d %d %d %d %d",&ax,&ay,&bx,&by,&tx,&ty);
	long double total, tdist, asv, bsv, asvmax, bsvmax, asvmax2, bsvmax2, maxsave;
	total = 0;
	scanf("%ld", &n);

	/* 1st bottle */
	scanf("%d %d",&x,&y);
	tdist = distt(x,y);
	total += tdist;
	asvmax = tdist - dista(x,y);
	bsvmax = tdist - distb(x,y);
	printf("%d %d %d %d %d %d ",ax,ay,bx,by,tx,ty);
	printf("%Lf %Lf %Lf", tdist, asvmax, bsvmax);

	/* the rest of the bottles */
	for (i = 1; i < n; i++) {
		scanf("%d %d",&x,&y);
		tdist = distt(x,y);
		total += tdist;
		asv = tdist - dista(x,y);
		bsv = tdist - distb(x,y);
		if (asv>asvmax) {
			asvmax2 = asvmax;
			asvmax = asv;
			ai = i;
		}
		if (bsv>bsvmax) {
			bsvmax2 = bsvmax;
			bsvmax = bsv;
			bi = i;
		}
	} // end of for loop

	if (ai == bi) {
		maxsave = max(max(asvmax+bsvmax2, asvmax2+bsvmax),max(asvmax,bsvmax));
	} else {
		maxsave = max(asvmax+bsvmax,max(asvmax,bsvmax));
	}

	printf("%.15Lf\n",total*2 - maxsave);

}

long double dista(long x,long y) {
	return sqrt(pow(x-ax,2)+pow(y-ay,2));
}
long double distb(long x,long y) {
	return sqrt(pow(x-bx,2)+pow(y-by,2));
}
long double distt(long x,long y) {
	return sqrt(pow(x-tx,2)+pow(y-ty,2));
}
long double max(long double a, long double b) {
	return a>b? a:b;
}


#include <stdio.h>
#include <math.h>

int ax,ay,bx,by,tx,ty;

long double distt(long,long);
long double dista(long,long);
long double distb(long,long);
long double max(long double, long double);
main()
{
	extern int ax,ay,bx,by,tx,ty;
	int i,x,y, ai, bi;
	long n, asave, bsave;
	scanf("%d %d %d %d %d %d",&ax,&ay,&bx,&by,&tx,&ty);
	long double total, tdist, asv, bsv, asvmax, bsvmax, asvmax2, bsvmax2, maxsave;
	total = 0;
	scanf("%ld", &n);

	/* 1st bottle */
	scanf("%d %d",&x,&y);
	tdist = distt(x,y);
	total += tdist;
	asvmax = tdist - dista(x,y);
	bsvmax = tdist - distb(x,y);
	asvmax2 = -1e10;
	bsvmax2 = -1e10;
	/* the rest of the bottles */
	for (i = 1; i < n; i++) {
		scanf("%d %d",&x,&y);
		tdist = distt(x,y);
		total += tdist;
		asv = tdist - dista(x,y);
		bsv = tdist - distb(x,y);
		if (asv>asvmax) {
			asvmax2 = asvmax;
			asvmax = asv;
			ai = i;
		} else if (asv>asvmax2) {
			asvmax2 = asv;
		}
		if (bsv>bsvmax) {
			bsvmax2 = bsvmax;
			bsvmax = bsv;
			bi = i;
		} else if (bsv>bsvmax2) {
			bsvmax2 = bsv;
		}
	} // end of for loop

	if (ai == bi) {
		printf("amax2 = %Lf, bmax2 = %Lf\n",asvmax2,bsvmax2)
		maxsave = max(max(asvmax+bsvmax2, asvmax2+bsvmax),max(asvmax,bsvmax));
	} else {
		maxsave = max(asvmax+bsvmax,max(asvmax,bsvmax));
	}

	printf("%.15Lf\n",total*2 - maxsave);

}

long double dista(long x,long y) {
	return sqrt(pow(x-ax,2)+pow(y-ay,2));
}
long double distb(long x,long y) {
	return sqrt(pow(x-bx,2)+pow(y-by,2));
}
long double distt(long x,long y) {
	return sqrt(pow(x-tx,2)+pow(y-ty,2));
}
long double max(long double a, long double b) {
	return a>b? a:b;
}


#include <stdio.h>
#include <math.h>

int ax,ay,bx,by,tx,ty;

long double distt(long,long);
long double dista(long,long);
long double distb(long,long);
long double max(long double, long double);
main()
{
	extern int ax,ay,bx,by,tx,ty;
	int i,x,y, ai, bi;
	long n, asave, bsave;
	scanf("%d %d %d %d %d %d",&ax,&ay,&bx,&by,&tx,&ty);
	long double total, tdist, asv, bsv, asvmax, bsvmax, asvmax2, bsvmax2, maxsave;
	total = 0;
	scanf("%ld", &n);

	/* 1st bottle */
	scanf("%d %d",&x,&y);
	tdist = distt(x,y);
	total += tdist;
	asvmax = tdist - dista(x,y);
	bsvmax = tdist - distb(x,y);
	asvmax2 = -2e10;
	bsvmax2 = -2e10;
	/* the rest of the bottles */
	for (i = 1; i < n; i++) {
		scanf("%d %d",&x,&y);
		tdist = distt(x,y);
		total += tdist;
		asv = tdist - dista(x,y);
		bsv = tdist - distb(x,y);
		if (asv>asvmax) {
			asvmax2 = asvmax;
			asvmax = asv;
			ai = i;
		} else if (asv>asvmax2) {
			asvmax2 = asv;
		}
		if (bsv>bsvmax) {
			bsvmax2 = bsvmax;
			bsvmax = bsv;
			bi = i;
		} else if (bsv>bsvmax2) {
			bsvmax2 = bsv;
		}
	} // end of for loop

	if (ai == bi) {
		maxsave = max(max(asvmax+bsvmax2, asvmax2+bsvmax),max(asvmax,bsvmax));
	} else {
		maxsave = max(asvmax+bsvmax,max(asvmax,bsvmax));
	}

	printf("%.15Lf\n",total*2 - maxsave);

}

long double dista(long x,long y) {
	return sqrt(pow(x-ax,2)+pow(y-ay,2));
}
long double distb(long x,long y) {
	return sqrt(pow(x-bx,2)+pow(y-by,2));
}
long double distt(long x,long y) {
	return sqrt(pow(x-tx,2)+pow(y-ty,2));
}
long double max(long double a, long double b) {
	return a>b? a:b;
}


#include <stdio.h>
#include <math.h>

int ax,ay,bx,by,tx,ty;

long double distt(long,long);
long double dista(long,long);
long double distb(long,long);
long double max(long double, long double);
main()
{
	extern int ax,ay,bx,by,tx,ty;
	int i,x,y, ai, bi;
	long n, asave, bsave;
	scanf("%d %d %d %d %d %d",&ax,&ay,&bx,&by,&tx,&ty);
	long double total, tdist, asv, bsv, asvmax, bsvmax, asvmax2, bsvmax2, maxsave;
	total = 0;
	scanf("%ld", &n);

	/* 1st bottle */
	scanf("%d %d",&x,&y);
	tdist = distt(x,y);
	total += tdist;
	asvmax = tdist - dista(x,y);
	bsvmax = tdist - distb(x,y);

	/* the rest of the bottles */
	for (i = 1; i < n; i++) {
		scanf("%d %d",&x,&y);
		tdist = distt(x,y);
		total += tdist;
		asv = tdist - dista(x,y);
		bsv = tdist - distb(x,y);
		if (asv>asvmax) {
			asvmax2 = asvmax;
			asvmax = asv;
			ai = i;
		}
		if (bsv>bsvmax) {
			bsvmax2 = bsvmax;
			bsvmax = bsv;
			bi = i;
		}
	} // end of for loop

	if (ai == bi) {
		maxsave = max(max(asvmax+bsvmax2, asvmax2+bsvmax),max(asvmax,bsvmax));
	} else {
		maxsave = max(asvmax+bsvmax,max(asvmax,bsvmax));
	}

	printf("%.15Lf\n",total*2 - maxsave);

}

long double dista(long x,long y) {
	return sqrt(pow(x-ax,2)+pow(y-ay,2));
}
long double distb(long x,long y) {
	return sqrt(pow(x-bx,2)+pow(y-by,2));
}
long double distt(long x,long y) {
	return sqrt(pow(x-tx,2)+pow(y-ty,2));
}
long double max(long double a, long double b) {
	return a>b? a:b;
}