#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<bitset>
#include<math.h>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
const int N=100010;
const int MAX=1000000100;
const int mod=100000000;
const int MOD1=1000000007;
const int MOD2=1000000009;
const double EPS=0.00000001;
typedef long long ll;
const ll MOD=1000000007;
const int INF=1000000010;
typedef double db;
typedef long double ldb;
typedef unsigned long long ull;
db x[N],y[N];
struct node {
int u;
db d;
node(){}
node(int u,db d):u(u),d(d){}
bool operator < (const node a) const{
return d>a.d;
}
}a[N],b[N];
db ddis(db x1,db y1,db x2,db y2) {
db x=x1-x2,y=y1-y2;
return sqrt(x*x+y*y);
}
int main()
{
int i,n;
db xa,xb,ya,yb,X,Y;
db ans=0,ans1,ans2,ans3;
scanf("%lf%lf%lf%lf%lf%lf", &xa, &ya, &xb, &yb, &X, &Y);
scanf("%d", &n);
for (i=1;i<=n;i++) scanf("%lf%lf", &x[i], &y[i]);
for (i=1;i<=n;i++) a[i]=node(i,ddis(x[i],y[i],X,Y)-ddis(x[i],y[i],xa,ya));
for (i=1;i<=n;i++) b[i]=node(i,ddis(x[i],y[i],X,Y)-ddis(x[i],y[i],xb,yb));
sort(a+1,a+n+1);
sort(b+1,b+n+1);
for (i=1;i<=n;i++) ans+=2.0*ddis(X,Y,x[i],y[i]);
ans1=min(ans-a[1].d,ans+ddis(xa,ya,X,Y));
ans2=min(ans-b[1].d,ans+ddis(xb,yb,X,Y));
if (a[1].u==b[1].u) {
if (a[1].d+b[2].d>=a[2].d+b[1].d) ans3=ans-a[1].d-b[2].d;
else ans3=ans-a[2].d-b[1].d;
} else {
ans3=ans-a[1].d-b[1].d;
}
printf("%.10f\n", min(ans1,min(ans2,ans3)));
return 0;
}