#include <iostream>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <map>
#include <set>
#include <iterator>
#include <vector>
#include <stdio.h>
#include <queue>
#include <deque>
#include <stack>
using namespace std;
typedef long ll;
typedef unsigned long long ull;
typedef double ld;
ll i, j, n;
ld ax, ay, bx, byy, tx, ty, all=0.0, sum=0.0;
struct rasp
{
ld x;
ld y;
ld d;
};
rasp r[100005];
ld ar[100005], br[100005], ad[100005], bd[100005];
set < pair < ld, ll > > aa, bb;
set < pair < ld, ll > >::iterator q,it,ti;
ld sum_now;
int main()
{
cin >> ax >> ay >> bx >> byy >> tx >> ty;
cin >> n;
for (i = 0; i < n; i++)
{
cin >> r[i].x >> r[i].y;
r[i].d = sqrt((r[i].x - tx)*(r[i].x - tx) + (r[i].y - ty)*(r[i].y - ty));
all += r[i].d * 2;
ld di= sqrt((r[i].x - ax)*(r[i].x - ax) + (r[i].y - ay)*(r[i].y - ay));
ar[i] = di-r[i].d;
ad[i] = di;
aa.insert(make_pair(di-r[i].d, i));
di = sqrt((r[i].x - bx)*(r[i].x - bx) + (r[i].y - byy)*(r[i].y - byy));
bb.insert(make_pair(di - r[i].d , i));
br[i] = di-r[i].d;
bd[i] = di;
}
q=aa.begin();
ld suma = all + ar[q->second];
q = bb.begin();
ld sumb = all + br[q->second];
if(suma>sumb)
sum = sumb;
else
sum=suma;
if (n > 1)
{
for (it = aa.begin(); it != aa.end(); it++)
{
i = it->second;
bb.erase(bb.find(make_pair(br[i], i)));
ti = bb.begin();
j = ti->second;
sum_now = all + ar[i] + br[j];
if(sum>sum_now)
sum=sum_now;
bb.insert(make_pair(br[i], i));
}
}
printf("%.7f", sum);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8bWF0aC5oPgojaW5jbHVkZSA8Y21hdGg+CiNpbmNsdWRlIDxzdHJpbmc+CiNpbmNsdWRlIDxtYXA+CiNpbmNsdWRlIDxzZXQ+CiNpb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