#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <cmath>
#include <set>
#include <fstream>
#include <cstring>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
#include <iterator>
using namespace std;

#define sqr(x) ((x)*(x))
#define cbr(x) ((x)*(x)*(x))
#define max(a, b) (((a)<(b))? (b):(a))
#define min(a, b) (((a)<(b))? (a):(b))
#define all(a) a.begin(), a.end()

#define _sp system("pause");
#define _ln cout << "------------------------------------------------\n";
#define FI(a, n) for(int i=a;i<n;i++)
#define FJ(a, n) for(int j=a;j<n;j++)
#define REP(a, b, c) for(int (c) = (a); (c) < (b); (c)++)
#define rep(a, b, c) for(int (c) = (a); (c) < (b); (c)++)

#define ll long long
#define ull unsigned long long
#define pii pair<int, int> 
#define mp(a, b) make_pair((a), (b))
#define pb(a) push_back((a))

#define x1 sasimathx1
#define y1 sasimathy1

void delbit(ll &a, ll k) { a &= (~(1 << k)); }
bool getbit(ll a, ll k) { return 1 & (a >> k); }
ll setbit(ll &a, ll k) { return a |= (1 << k); }

inline ll mulmod(ll x, ll n, ll _mod) { ll res = 0; while (n) { if (n & 1)res = (res + x) % _mod; x = (x + x) % _mod; n >>= 1; }return res; }
inline ll powmod(ll x, ll n, ll _mod) { ll res = 1; while (n) { if (n & 1)res = (res*x) % _mod; x = (x*x) % _mod; n >>= 1; }return res; }
inline ll gcd(ll a, ll b) { ll t; while (b) { a = a%b; t = a; a = b; b = t; }return a; }
inline int gcd(int a, int b) { int t; while (b) { a = a%b; t = a; a = b; b = t; }return a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
inline ll gcd(ll a, ll b, ll c) { return gcd(gcd(a, b), c); }
inline int gcd(int a, int b, int c) { return gcd(gcd(a, b), c); }
double dist(double ax, double ay, double bx, double by) { return sqrt(sqr(ax - bx) + sqr(ay - by)); }

//constants
#define PI 3.1415926535897932
#define INF 2147483640
#define LLINF 9223372036854775806
#define eps 1e-14
//-------------------------------------------------
#define N 100010

pair<double, int> p[N];
double da[N];
int n;

double go(int j) {
	rep(0, n, i) {
		if (p[i].second != j)return p[i].first;
	}
	return LLINF;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	double Ax, Bx, Tx, Ay, By, Ty, sum = 0;
	cin >> Ax >> Ay >> Bx >> By >> Tx >> Ty;
	cin >> n;

	rep(0, n, i) {
		double x, y;
		cin >> x >> y;
		double add = dist(Tx, Ty, x, y);
		sum += add * 2;
		p[i].first = dist(Bx, By, x, y) - add;
		p[i].second = i;
		da[i] = dist(Ax, Ay, x, y) - add;
	}

	sort(p, p + n);

	double ans = LLINF;
	rep(0, n, i) {
		ans = min(ans, sum + da[i] + min(0, go(i)));
	}
	ans = min(ans, sum + go(-1));

	printf("%.12lf\n", ans);

	return 0;
}