//By Ralif Rakhmatullin
#include<iostream>
#include<fstream>
#include<string>
#include<cstring>
#include<math.h>
#include<cassert>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<bitset>
#include<valarray>
#include<iterator>
#include<list>
#define ll long long
#define ull unsigned long long
#define mp make_pair
#define S second
#define F first
#define y1 LOL
#define ld long double
#define pb push_back
#define len length
#define sz size
#define beg begin
const ld inf=(ld)1e10;
const int mod=1e9+7;
using namespace std;
ld ax, ay, bx, by, tx, ty, x[100011], y[100011];
int n;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	//cout.tie(0);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin >> ax >> ay >> bx >> by >> tx >> ty >> n;
	for(int i = 1; i <= n; i ++){
		cin >> x[i] >> y[i];
	}
	if(n == 1){
		cout << fixed << setprecision(7) << min(sqrt((x[1] - ax) * (x[1] - ax) + (y[1] - ay) * (y[1] - ay)),  sqrt((x[1] - bx) * (x[1] - bx) + (y[1] - by) * (y[1] - by))) + sqrt((tx - x[1]) * (tx - x[1]) + (ty - y[1]) * (ty - y[1]) );
		return 0;
	}
	vector<pair<ld, int> > q, q1;
	for(int i = 1; i <= n; i ++){
		ld f = sqrt((x[i] - tx) * (x[i] - tx) + (y[i] - ty) * (y[i] - ty));
		q.pb(mp(sqrt((x[i] - ax) * (x[i] - ax) + (y[i] - ay) * (y[i] - ay)) - f, i));
		q1.pb(mp(sqrt((x[i] - bx) * (x[i] - bx) + (y[i] - by) * (y[i] - by)) - f, i));
	}
	sort(q.beg(), q.end());
	sort(q1.beg(), q1.end());
	//reverse(q.beg(), q.end());
	//reverse(q1.beg(), q1.end());
	ld sum = 0, mn = inf;
	for(int i = 1; i <= n; i ++){
		sum += sqrt((x[i] - tx) * (x[i] - tx) + (y[i] - ty) * (y[i] - ty)) * 2;
	}
	mn = min(mn, sum + q[0].F);
	mn = min(mn, sum + q1[0].F);
	if(q[0].S == q1[0].S){
		mn = min(mn, sum + q[0].F + q1[1].F);
		mn = min(mn, sum + q[1].F + q1[0].F);
	}else
		mn = min(mn, sum + q[0].F + q1[0].F);
	/*for(int i = 0; i < n; i ++){
		cout << q[i].F << " " << q[i].S << " \n" ;
	}
	cout << endl;
	for(int i = 0; i < n; i ++){
		cout << q1[i].F << " " << q1[i].S << "\n" ;
	}      */
	cout << fixed << setprecision(7) << mn;
	return 0;
}


//By Ralif Rakhmatullin
#include<iostream>
#include<fstream>
#include<string>
#include<cstring>
#include<math.h>
#include<cassert>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<bitset>
#include<valarray>
#include<iterator>
#include<list>
#define ll long long
#define ull unsigned long long
#define mp make_pair
#define S second
#define F first
#define y1 LOL
#define ld long double
#define pb push_back
#define len length
#define sz size
#define beg begin
const ld inf=(ld)1e10;
const int mod=1e9+7;
using namespace std;
ld ax, ay, bx, by, tx, ty, x[100011], y[100011];
int n;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	//cout.tie(0);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin >> ax >> ay >> bx >> by >> tx >> ty >> n;
	for(int i = 1; i <= n; i ++){
		cin >> x[i] >> y[i];
	}
	if(n == 1){
		cout << fixed << setprecision(7) << min(sqrt((x[1] - ax) * (x[1] - ax) + (y[1] - ay) * (y[1] - ay)),  sqrt((x[1] - bx) * (x[1] - bx) + (y[1] - by) * (y[1] - by))) + sqrt((tx - x[1]) * (tx - x[1]) + (ty - y[1]) * (ty - y[1]) );
		return 0;
	}
	vector<pair<ld, int> > q, q1;
	for(int i = 1; i <= n; i ++){
		ld h = sqrt((x[i] - ax) * (x[i] - ax) + (y[i] - ay) * (y[i] - ay));
		ld f = sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
		if(f >= h)
			q.pb(mp(f - h, i));
		h = sqrt((x[i] - bx) * (x[i] - bx) + (y[i] - by) * (y[i] - by));
		if(f >= h)
			q1.pb(mp(f - h, i));
	}
	sort(q.beg(), q.end());
	sort(q1.beg(), q1.end());
	reverse(q.beg(), q.end());
	reverse(q1.beg(), q1.end());
	int id1 = 0, id2 = 0;
	ld sum = 0;
	if(q.sz() && !q1.sz()){
		for(int i = 1; i <= n; i ++){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			if(i != q[0].S){
				sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			}else{
				sum += sqrt((ax - x[i]) * (ax - x[i]) + (ay - y[i]) * (ay - y[i]));
			}
		}
		cout << fixed << setprecision(7) << sum;
		return 0;
	}
	if(!q.sz() && q1.sz()){
		for(int i = 1; i <= n; i ++){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			if(i != q1[0].S){
				sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			}else
				sum += sqrt((bx - x[i]) * (bx - x[i]) + (by - y[i]) * (by - y[i]));
		}
		cout << fixed << setprecision(7) << sum;
		return 0;
	}
	if(!q.sz() && !q1.sz()){
		ld mx = -inf;
		int id = 0;
		for(int i = 1; i <= n; i ++){
			ld h = sqrt((bx - x[i]) * (bx - x[i]) + (by - y[i]) * (by - y[i]));
			h = min(h, sqrt((ax - x[i]) * (ax - x[i]) + (ay - y[i]) * (ay - y[i])));
			if(mx < sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i])) - h){
				mx = sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i])) - h;
				id = i;
			}
		}
		//cout << mx << endl;
		for(int i = 1; i <= n; i ++){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			if(i != id){
				sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			}else{
				sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i])) - mx;
			}
		}
		cout << fixed << setprecision(7) << sum;
		return 0;
	}
	if(q[0].S == q1[0].S){
		if(q[0].F < q1[0].F){
			id1 = 1;
		}else{
			id2 = 1;
		}
	}
	for(int i = 1; i <= n; i ++){
		sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
		if(i == q[id1].S){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i])) - q[id1].F;
		}else
		if(i == q1[id2].S){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i])) - q1[id2].F;
		}else
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]) );
	}                  /*
	for(int i = 0; i < q.sz(); i ++){
		cout << q[i].F << " " << q[i].S << endl;
	}
	cout << "/\n";
	for(int i = 0; i < q1.sz(); i ++){
		cout << fixed << setprecision(6) << q1[i].F << " " << fixed << setprecision(6) <<  q1[i].S << endl;
	}                */
	cout << fixed << setprecision(7) << sum;
	return 0;
}


//By Ralif Rakhmatullin
#include<iostream>
#include<fstream>
#include<string>
#include<cstring>
#include<math.h>
#include<cassert>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<bitset>
#include<valarray>
#include<iterator>
#include<list>
#define ll long long
#define ull unsigned long long
#define mp make_pair
#define S second
#define F first
#define y1 LOL
#define ld long double
#define pb push_back
#define len length
#define sz size
#define beg begin
const ld inf=(ld)1e10;
const int mod=1e9+7;
using namespace std;
ld ax, ay, bx, by, tx, ty, x[100011], y[100011];
int n;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	//cout.tie(0);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin >> ax >> ay >> bx >> by >> tx >> ty >> n;
	for(int i = 1; i <= n; i ++){
		cin >> x[i] >> y[i];
	}
	if(n == 1){
		cout << min(sqrt((x[1] - ax) * (x[1] - ax) + (y[1] - ay) * (y[1] - ay)),  sqrt((x[1] - bx) * (x[1] - bx) + (y[1] - by) * (y[1] - by)));
		return 0;
	}
	vector<pair<ld, int> > q, q1;
	for(int i = 1; i <= n; i ++){
		ld h = sqrt((x[i] - ax) * (x[i] - ax) + (y[i] - ay) * (y[i] - ay));
		ld f = sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
		if(f >= h)
			q.pb(mp(f - h, i));
		h = sqrt((x[i] - bx) * (x[i] - bx) + (y[i] - by) * (y[i] - by));
		if(f >= h)
			q1.pb(mp(f - h, i));
	}
	sort(q.beg(), q.end());
	sort(q1.beg(), q1.end());
	reverse(q.beg(), q.end());
	reverse(q1.beg(), q1.end());
	int id1 = 0, id2 = 0;
	ld sum = 0;
	if(q.sz() && !q1.sz()){
		for(int i = 1; i <= n; i ++){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			if(i != q[0].S){
				sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			}else{
				sum += sqrt((ax - x[i]) * (ax - x[i]) + (ay - y[i]) * (ay - y[i]));
			}
		}
		cout << sum;
		return 0;
	}
	if(!q.sz() && q1.sz()){
		for(int i = 1; i <= n; i ++){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			if(i != q1[0].S){
				sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			}else
				sum += sqrt((bx - x[i]) * (bx - x[i]) + (by - y[i]) * (by - y[i]));
		}
		cout << sum;
		return 0;
	}
	if(!q.sz() && !q1.sz()){
		ld mx = -inf;
		int id = 0;
		for(int i = 1; i <= n; i ++){
			ld h = sqrt((bx - x[i]) * (bx - x[i]) + (by - y[i]) * (by - y[i]));
			h = min(h, sqrt((ax - x[i]) * (ax - x[i]) + (ay - y[i]) * (ay - y[i])));
			mx = max(mx, sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i])) - h);
		}
		sum += mx;
		for(int i = 1; i <= n; i ++){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			if(i != id){
				sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			}
		}
		cout << sum;
		return 0;
	}
	if(q[0].S == q1[0].S){
		if(q[0].F < q1[0].F){
			id1 = 1;
		}else{
			id2 = 1;
		}
	}
	for(int i = 1; i <= n; i ++){
		sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
		if(i == q[id1].S){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i])) - q[id1].F;
		}else
		if(i == q1[id2].S){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i])) - q1[id2].F;
		}else
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]) );
	}                  /*
	for(int i = 0; i < q.sz(); i ++){
		cout << q[i].F << " " << q[i].S << endl;
	}
	cout << "/\n";
	for(int i = 0; i < q1.sz(); i ++){
		cout << fixed << setprecision(6) << q1[i].F << " " << fixed << setprecision(6) <<  q1[i].S << endl;
	}                */
	cout << fixed << setprecision(6) << sum;
	return 0;
}


//By Ralif Rakhmatullin
#include<iostream>
#include<fstream>
#include<string>
#include<cstring>
#include<math.h>
#include<cassert>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<bitset>
#include<valarray>
#include<iterator>
#include<list>
#define ll long long
#define ull unsigned long long
#define mp make_pair
#define S second
#define F first
#define y1 LOL
#define ld long double
#define pb push_back
#define len length
#define sz size
#define beg begin
const ld inf=(ld)1e10;
const int mod=1e9+7;
using namespace std;
ld ax, ay, bx, by, tx, ty, x[100011], y[100011];
int n;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	//cout.tie(0);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin >> ax >> ay >> bx >> by >> tx >> ty >> n;
	for(int i = 1; i <= n; i ++){
		cin >> x[i] >> y[i];
	}
	if(n == 1){
		cout << min(sqrt((x[1] - ax) * (x[1] - ax) + (y[1] - ay) * (y[1] - ay)),  sqrt((x[1] - bx) * (x[1] - bx) + (y[1] - by) * (y[1] - by)));
		return 0;
	}
	vector<pair<ld, int> > q, q1;
	for(int i = 1; i <= n; i ++){
		ld h = sqrt((x[i] - ax) * (x[i] - ax) + (y[i] - ay) * (y[i] - ay));
		ld f = sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
		if(f >= h)
			q.pb(mp(f - h, i));
		h = sqrt((x[i] - bx) * (x[i] - bx) + (y[i] - by) * (y[i] - by));
		if(f >= h)
			q1.pb(mp(f - h, i));
	}
	sort(q.beg(), q.end());
	sort(q1.beg(), q1.end());
	reverse(q.beg(), q.end());
	reverse(q1.beg(), q1.end());
	int id1 = 0, id2 = 0;
	ld sum = 0;
	if(q.sz() && !q1.sz()){
		for(int i = 1; i <= n; i ++){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			if(i != q[0].S){
				sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			}else{
				sum += sqrt((ax - x[i]) * (ax - x[i]) + (ay - y[i]) * (ay - y[i]));
			}
		}
		cout << fixed << setprecision(7) << sum;
		return 0;
	}
	if(!q.sz() && q1.sz()){
		for(int i = 1; i <= n; i ++){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			if(i != q1[0].S){
				sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			}else
				sum += sqrt((bx - x[i]) * (bx - x[i]) + (by - y[i]) * (by - y[i]));
		}
		cout << fixed << setprecision(7) << sum;
		return 0;
	}
	if(!q.sz() && !q1.sz()){
		ld mx = -inf;
		int id = 0;
		for(int i = 1; i <= n; i ++){
			ld h = sqrt((bx - x[i]) * (bx - x[i]) + (by - y[i]) * (by - y[i]));
			h = min(h, sqrt((ax - x[i]) * (ax - x[i]) + (ay - y[i]) * (ay - y[i])));
			if(mx < sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i])) - h){
				mx = sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i])) - h;
				id = i;
			}
		}
		//cout << mx << endl;
		for(int i = 1; i <= n; i ++){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			if(i != id){
				sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			}else{
				sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i])) - mx;
			}
		}
		cout << fixed << setprecision(7) << sum;
		return 0;
	}
	if(q[0].S == q1[0].S){
		if(q[0].F < q1[0].F){
			id1 = 1;
		}else{
			id2 = 1;
		}
	}
	for(int i = 1; i <= n; i ++){
		sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
		if(i == q[id1].S){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i])) - q[id1].F;
		}else
		if(i == q1[id2].S){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i])) - q1[id2].F;
		}else
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]) );
	}                  /*
	for(int i = 0; i < q.sz(); i ++){
		cout << q[i].F << " " << q[i].S << endl;
	}
	cout << "/\n";
	for(int i = 0; i < q1.sz(); i ++){
		cout << fixed << setprecision(6) << q1[i].F << " " << fixed << setprecision(6) <<  q1[i].S << endl;
	}                */
	cout << fixed << setprecision(7) << sum;
	return 0;
}


//By Ralif Rakhmatullin
#include<iostream>
#include<fstream>
#include<string>
#include<cstring>
#include<math.h>
#include<cassert>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<bitset>
#include<valarray>
#include<iterator>
#include<list>
#define ll long long
#define ull unsigned long long
#define mp make_pair
#define S second
#define F first
#define y1 LOL
#define ld long double
#define pb push_back
#define len length
#define sz size
#define beg begin
const ld inf=(ld)1e10;
const int mod=1e9+7;
using namespace std;
ld ax, ay, bx, by, tx, ty, x[100011], y[100011];
int n;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	//cout.tie(0);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin >> ax >> ay >> bx >> by >> tx >> ty >> n;
	for(int i = 1; i <= n; i ++){
		cin >> x[i] >> y[i];
	}
	if(n == 1){
		cout << min(sqrt((x[1] - ax) * (x[1] - ax) + (y[1] - ay) * (y[1] - ay)),  sqrt((x[1] - bx) * (x[1] - bx) + (y[1] - by) * (y[1] - by)));
		return 0;
	}
	vector<pair<ld, int> > q, q1;
	for(int i = 1; i <= n; i ++){
		ld h = sqrt((x[i] - ax) * (x[i] - ax) + (y[i] - ay) * (y[i] - ay));
		ld f = sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
		if(f >= h)
			q.pb(mp(f - h, i));
		h = sqrt((x[i] - bx) * (x[i] - bx) + (y[i] - by) * (y[i] - by));
		if(f >= h)
			q1.pb(mp(f - h, i));
	}
	sort(q.beg(), q.end());
	sort(q1.beg(), q1.end());
	reverse(q.beg(), q.end());
	reverse(q1.beg(), q1.end());
	int id1 = 0, id2 = 0;
	ld sum = 0;
	if(q.sz() && !q1.sz()){
		for(int i = 1; i <= n; i ++){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			if(i != q[0].S){
				sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			}else{
				sum += sqrt((ax - x[i]) * (ax - x[i]) + (ay - y[i]) * (ay - y[i]));
			}
		}
		cout << fixed << setprecision(6) << sum;
		return 0;
	}
	if(!q.sz() && q1.sz()){
		for(int i = 1; i <= n; i ++){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			if(i != q1[0].S){
				sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			}else
				sum += sqrt((bx - x[i]) * (bx - x[i]) + (by - y[i]) * (by - y[i]));
		}
		cout << fixed << setprecision(6) << sum;
		return 0;
	}
	if(!q.sz() && !q1.sz()){
		ld mx = -inf;
		int id = 0;
		for(int i = 1; i <= n; i ++){
			ld h = sqrt((bx - x[i]) * (bx - x[i]) + (by - y[i]) * (by - y[i]));
			h = min(h, sqrt((ax - x[i]) * (ax - x[i]) + (ay - y[i]) * (ay - y[i])));
			if(mx < sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i])) - h){
				mx = sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i])) - h;
				id = i;
			}
		}
		for(int i = 1; i <= n; i ++){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			if(i != id){
				sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			}else{
				sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i])) - mx;
			}
		}
		cout << fixed << setprecision(6) << sum;
		return 0;
	}
	if(q[0].S == q1[0].S){
		if(q[0].F < q1[0].F){
			id1 = 1;
		}else{
			id2 = 1;
		}
	}
	for(int i = 1; i <= n; i ++){
		sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
		if(i == q[id1].S){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i])) - q[id1].F;
		}else
		if(i == q1[id2].S){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i])) - q1[id2].F;
		}else
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]) );
	}                  /*
	for(int i = 0; i < q.sz(); i ++){
		cout << q[i].F << " " << q[i].S << endl;
	}
	cout << "/\n";
	for(int i = 0; i < q1.sz(); i ++){
		cout << fixed << setprecision(6) << q1[i].F << " " << fixed << setprecision(6) <<  q1[i].S << endl;
	}                */
	cout << fixed << setprecision(6) << sum;
	return 0;
}


//By Ralif Rakhmatullin
#include<iostream>
#include<fstream>
#include<string>
#include<cstring>
#include<math.h>
#include<cassert>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<bitset>
#include<valarray>
#include<iterator>
#include<list>
#define ll long long
#define ull unsigned long long
#define mp make_pair
#define S second
#define F first
#define y1 LOL
#define ld long double
#define pb push_back
#define len length
#define sz size
#define beg begin
const ld inf=(ld)1e10;
const int mod=1e9+7;
using namespace std;
ld ax, ay, bx, by, tx, ty, x[100011], y[100011];
int n;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	//cout.tie(0);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin >> ax >> ay >> bx >> by >> tx >> ty >> n;
	for(int i = 1; i <= n; i ++){
		cin >> x[i] >> y[i];
	}
	if(n == 1){
		cout << fixed << setprecision(7) << min(sqrt((x[1] - ax) * (x[1] - ax) + (y[1] - ay) * (y[1] - ay)),  sqrt((x[1] - bx) * (x[1] - bx) + (y[1] - by) * (y[1] - by))) + sqrt((tx - x[1]) * (tx - x[1]) + (ty - y[1]) * (ty - y[1]) );
		return 0;
	}
	vector<pair<ld, int> > q, q1;
	for(int i = 1; i <= n; i ++){
		ld f = sqrt((x[i] - tx) * (x[i] - tx) + (y[i] - ty) * (y[i] - ty));
		q.pb(mp(sqrt((x[i] - ax) * (x[i] - ax) + (y[i] - ay) * (y[i] - ay)) - f, i));
		q1.pb(mp(sqrt((x[i] - bx) * (x[i] - bx) + (y[i] - by) * (y[i] - by)) - f, i));
	}
	sort(q.beg(), q.end());
	sort(q1.beg(), q1.end());
	//reverse(q.beg(), q.end());
	//reverse(q1.beg(), q1.end());
	ld sum = 0, mn = inf;
	for(int i = 1; i <= n; i ++){
		sum += sqrt((x[i] - tx) * (x[i] - tx) + (y[i] - ty) * (y[i] - ty)) * 2;
	}
	mn = min(mn, sum + q[0].F);
	mn = min(mn, sum + q1[0].F);
	if(q[0].S == q1[0].S){
		mn = min(mn, sum + q[0].F + q1[1].F);
		mn = min(mn, sum + q[1].F + q1[0].F);
	}else
		mn = min(mn, sum + q[0].F + q1[0].F);
	for(int i = 0; i < n; i ++){
		cout << q[i].F << " " << q[i].S << " \n" ;
	}
	cout << endl;
	for(int i = 0; i < n; i ++){
		cout << q1[i].F << " " << q1[i].S << "\n" ;
	}
	cout << fixed << setprecision(7) << mn;
	return 0;
}


//By Ralif Rakhmatullin
#include<iostream>
#include<fstream>
#include<string>
#include<cstring>
#include<math.h>
#include<cassert>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<bitset>
#include<valarray>
#include<iterator>
#include<list>
#define ll long long
#define ull unsigned long long
#define mp make_pair
#define S second
#define F first
#define y1 LOL
#define ld long double
#define pb push_back
#define len length
#define sz size
#define beg begin
const ld inf=(ld)1e10;
const int mod=1e9+7;
using namespace std;
ld ax, ay, bx, by, tx, ty, x[100011], y[100011];
int n;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	//cout.tie(0);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin >> ax >> ay >> bx >> by >> tx >> ty >> n;
	for(int i = 1; i <= n; i ++){
		cin >> x[i] >> y[i];
	}
	if(n == 1){
		cout << min(sqrt((x[1] - ax) * (x[1] - ax) + (y[1] - ay) * (y[1] - ay)),  sqrt((x[1] - bx) * (x[1] - bx) + (y[1] - by) * (y[1] - by))) + sqrt((tx - x[1]) * (tx - x[1]) + (ty - y[1]) * (ty - y[1]) );
		return 0;
	}
	vector<pair<ld, int> > q, q1;
	for(int i = 1; i <= n; i ++){
		ld h = sqrt((x[i] - ax) * (x[i] - ax) + (y[i] - ay) * (y[i] - ay));
		ld f = sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
		if(f >= h)
			q.pb(mp(f - h, i));
		h = sqrt((x[i] - bx) * (x[i] - bx) + (y[i] - by) * (y[i] - by));
		if(f >= h)
			q1.pb(mp(f - h, i));
	}
	sort(q.beg(), q.end());
	sort(q1.beg(), q1.end());
	reverse(q.beg(), q.end());
	reverse(q1.beg(), q1.end());
	int id1 = 0, id2 = 0;
	ld sum = 0;
	if(q.sz() && !q1.sz()){
		for(int i = 1; i <= n; i ++){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			if(i != q[0].S){
				sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			}else{
				sum += sqrt((ax - x[i]) * (ax - x[i]) + (ay - y[i]) * (ay - y[i]));
			}
		}
		cout << fixed << setprecision(7) << sum;
		return 0;
	}
	if(!q.sz() && q1.sz()){
		for(int i = 1; i <= n; i ++){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			if(i != q1[0].S){
				sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			}else
				sum += sqrt((bx - x[i]) * (bx - x[i]) + (by - y[i]) * (by - y[i]));
		}
		cout << fixed << setprecision(7) << sum;
		return 0;
	}
	if(!q.sz() && !q1.sz()){
		ld mx = -inf;
		int id = 0;
		for(int i = 1; i <= n; i ++){
			ld h = sqrt((bx - x[i]) * (bx - x[i]) + (by - y[i]) * (by - y[i]));
			h = min(h, sqrt((ax - x[i]) * (ax - x[i]) + (ay - y[i]) * (ay - y[i])));
			if(mx < sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i])) - h){
				mx = sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i])) - h;
				id = i;
			}
		}
		//cout << mx << endl;
		for(int i = 1; i <= n; i ++){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			if(i != id){
				sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
			}else{
				sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i])) - mx;
			}
		}
		cout << fixed << setprecision(7) << sum;
		return 0;
	}
	if(q[0].S == q1[0].S){
		if(q[0].F < q1[0].F){
			id1 = 1;
		}else{
			id2 = 1;
		}
	}
	for(int i = 1; i <= n; i ++){
		sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
		if(i == q[id1].S){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i])) - q[id1].F;
		}else
		if(i == q1[id2].S){
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i])) - q1[id2].F;
		}else
			sum += sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]) );
	}                  /*
	for(int i = 0; i < q.sz(); i ++){
		cout << q[i].F << " " << q[i].S << endl;
	}
	cout << "/\n";
	for(int i = 0; i < q1.sz(); i ++){
		cout << fixed << setprecision(6) << q1[i].F << " " << fixed << setprecision(6) <<  q1[i].S << endl;
	}                */
	cout << fixed << setprecision(7) << sum;
	return 0;
}


//By Ralif Rakhmatullin
#include<iostream>
#include<fstream>
#include<string>
#include<cstring>
#include<math.h>
#include<cassert>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<stack>
#include<set>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<bitset>
#include<valarray>
#include<iterator>
#include<list>
#define ll long long
#define ull unsigned long long
#define mp make_pair
#define S second
#define F first
#define y1 LOL
#define ld long double
#define pb push_back
#define len length
#define sz size
#define beg begin
const ld inf=(ld)1e18;
const int mod=1e9+7;
using namespace std;
ld ax, ay, bx, by, tx, ty, x[100011], y[100011];
int n;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	//cout.tie(0);
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	cin >> ax >> ay >> bx >> by >> tx >> ty >> n;
	for(int i = 1; i <= n; i ++){
		cin >> x[i] >> y[i];
	}
	if(n == 1){
		cout << fixed << setprecision(7) << min(sqrt((x[1] - ax) * (x[1] - ax) + (y[1] - ay) * (y[1] - ay)),  sqrt((x[1] - bx) * (x[1] - bx) + (y[1] - by) * (y[1] - by))) + sqrt((tx - x[1]) * (tx - x[1]) + (ty - y[1]) * (ty - y[1]) );
		return 0;
	}
	vector<pair<ld, int> > q, q1;
	for(int i = 1; i <= n; i ++){
		ld f = sqrt((x[i] - tx) * (x[i] - tx) + (y[i] - ty) * (y[i] - ty));
		q.pb(mp(sqrt((x[i] - ax) * (x[i] - ax) + (y[i] - ay) * (y[i] - ay)) - f, i));
		q1.pb(mp(sqrt((x[i] - bx) * (x[i] - bx) + (y[i] - by) * (y[i] - by)) - f, i));
	}
	sort(q.beg(), q.end());
	sort(q1.beg(), q1.end());
	//reverse(q.beg(), q.end());
	//reverse(q1.beg(), q1.end());
	ld sum = 0, mn = inf;
	for(int i = 1; i <= n; i ++){
		sum += sqrt((x[i] - tx) * (x[i] - tx) + (y[i] - ty) * (y[i] - ty)) * 2;
	}
	mn = min(mn, sum + q[0].F);
	mn = min(mn, sum + q1[0].F);
	if(q[0].S == q1[0].S){
		mn = min(mn, sum + q[0].F + q1[1].F);
		mn = min(mn, sum + q[1].F + q1[0].F);
	}else
		mn = min(mn, sum + q[0].F + q1[0].F);
	/*for(int i = 0; i < n; i ++){
		cout << q[i].F << " " << q[i].S << " \n" ;
	}
	cout << endl;
	for(int i = 0; i < n; i ++){
		cout << q1[i].F << " " << q1[i].S << "\n" ;
	}      */
	cout << fixed << setprecision(7) << mn;
	return 0;
}


/*	 Hello World!	*/

#include <bits/stdc++.h>

#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define s second
#define let(x,a) __typeof(a) x(a)
#define all(a) (a).begin(),(a).end()
#define endl '\n'
#define present(c,x) ((c).find(x) != (c).end())
#define tr(v,it) for( let(it,v.begin()) ; it != v.end() ; it++)
#define rtr(v,it) for( let(it,v.rbegin()) ; it != v.rend() ; it++)
#define rep1(i,n) for(int i=0; i<(int)n;i++)
#define rep2(i,a,b) for(int i=(int)a; i<=(int)b; i++)

#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#define LL long long int
#define PII pair<int,int>
#define VI vector<int>
#define inf INT_MAX

using namespace std;

void FastIO()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
}

double dist(LL ax, LL ay, LL bx, LL by)
{
	double d=(ax-bx)*(ax-bx)+(ay-by)*(ay-by);
	return sqrt(d);
}

int main()
{
	FastIO();
	LL ax,ay,bx,by,tx,ty,n,x,y;
	double ans=0;
	vector< pair< pair<double,int>,int > > V1,V2;
	cin>>ax>>ay>>bx>>by>>tx>>ty>>n;
	for(int i=0;i<n;i++)
	{
		cin>>x>>y;
		double d=2*dist(tx,ty,x,y);
		double e=dist(ax,ay,x,y)+dist(x,y,tx,ty);
		double f=dist(bx,by,x,y)+dist(x,y,tx,ty);
		ans+=d;
		V1.pb(mp(mp(e-d,i),1));
		V2.pb(mp(mp(f-d,i),2));
	}
	sort(all(V1));
	sort(all(V2));
	double A=1e18;
	V1.pb(mp(mp(1e18,-1),1));
	V2.pb(mp(mp(1e18,-1),2));
	for(int i=0;i<=n;i++)
	{
		int k=0;
		while(V2[k].f.s==V1[i].f.s) k++;
		A=min(A,min(min(ans+V1[i].f.f,ans+V2[k].f.f),ans+V1[i].f.f+V2[k].f.f));
	}
	cout<<setprecision(10)<<fixed<<A<<endl;
	return 0;
}


/*	 Hello World!	*/

#include <bits/stdc++.h>

#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define s second
#define let(x,a) __typeof(a) x(a)
#define all(a) (a).begin(),(a).end()
#define endl '\n'
#define present(c,x) ((c).find(x) != (c).end())
#define tr(v,it) for( let(it,v.begin()) ; it != v.end() ; it++)
#define rtr(v,it) for( let(it,v.rbegin()) ; it != v.rend() ; it++)
#define rep1(i,n) for(int i=0; i<(int)n;i++)
#define rep2(i,a,b) for(int i=(int)a; i<=(int)b; i++)

#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#define LL long long int
#define PII pair<int,int>
#define VI vector<int>
#define inf INT_MAX

using namespace std;

void FastIO()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
}

double dist(LL ax, LL ay, LL bx, LL by)
{
	double d=(ax-bx)*(ax-bx)+(ay-by)*(ay-by);
	return sqrt(d);
}

int main()
{
	FastIO();
	LL ax,ay,bx,by,tx,ty,n,x,y;
	double ans=0;
	vector< pair< pair<double,int>,int > > V1,V2;
	cin>>ax>>ay>>bx>>by>>tx>>ty>>n;
	for(int i=0;i<n;i++)
	{
		cin>>x>>y;
		double d=2*dist(tx,ty,x,y);
		double e=dist(ax,ay,x,y)+dist(x,y,tx,ty);
		double f=dist(bx,by,x,y)+dist(x,y,tx,ty);
		trace2(e,f);
		ans+=d;
		V1.pb(mp(mp(e-d,i),1));
		V2.pb(mp(mp(f-d,i),2));
	}
	sort(all(V1));
	sort(all(V2));
	double A=1e18;
	V1.pb(mp(mp(1e9,-1),1));
	V2.pb(mp(mp(1e9,-1),2));
	for(int i=0;i<=n;i++)
	{
		int k=0;
		while(V2[k].f.s==V1[i].f.s) k++;
		trace3(V1[i].f.f,V2[k].f.f,ans);
		A=min(A,min(min(ans+V1[i].f.f,ans+V2[k].f.f),ans+V1[i].f.f+V2[k].f.f));
	}
	cout<<setprecision(10)<<fixed<<A<<endl;
	return 0;
}


/*	 Hello World!	*/

#include <bits/stdc++.h>

#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define s second
#define let(x,a) __typeof(a) x(a)
#define all(a) (a).begin(),(a).end()
#define endl '\n'
#define present(c,x) ((c).find(x) != (c).end())
#define tr(v,it) for( let(it,v.begin()) ; it != v.end() ; it++)
#define rtr(v,it) for( let(it,v.rbegin()) ; it != v.rend() ; it++)
#define rep1(i,n) for(int i=0; i<(int)n;i++)
#define rep2(i,a,b) for(int i=(int)a; i<=(int)b; i++)

#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#define LL long long int
#define PII pair<int,int>
#define VI vector<int>
#define inf INT_MAX

using namespace std;

void FastIO()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
}

double dist(LL ax, LL ay, LL bx, LL by)
{
	double d=(ax-bx)*(ax-bx)+(ay-by)*(ay-by);
	return sqrt(d);
}

int main()
{
	FastIO();
	LL ax,ay,bx,by,tx,ty,n,x,y;
	double ans=0;
	vector< pair< pair<double,int>,int > > V;
	cin>>ax>>ay>>bx>>by>>tx>>ty>>n;
	for(int i=0;i<n;i++)
	{
		cin>>x>>y;
		double d=2*dist(tx,ty,x,y);
		double e=dist(ax,ay,x,y)+dist(x,y,tx,ty);
		double f=dist(bx,by,x,y)+dist(x,y,tx,ty);
		ans+=d;
		V.pb(mp(mp(e-d,i),1));
		V.pb(mp(mp(f-d,i),2));
	}
	sort(all(V));
	int k=V[0].f.s,l=V[0].s;
	ans+=V[0].f.f;
	for(int i=1;i<2*n;i++)
	{
		if(V[i].f.s!=k && V[i].s!=l && V[i].f.f<0)
		{
			ans+=V[i].f.f;
			break;
		}
	}
	cout<<setprecision(10)<<fixed<<ans<<endl;
	return 0;
}


/*	 Hello World!	*/

#include <bits/stdc++.h>

#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define s second
#define let(x,a) __typeof(a) x(a)
#define all(a) (a).begin(),(a).end()
#define endl '\n'
#define present(c,x) ((c).find(x) != (c).end())
#define tr(v,it) for( let(it,v.begin()) ; it != v.end() ; it++)
#define rtr(v,it) for( let(it,v.rbegin()) ; it != v.rend() ; it++)
#define rep1(i,n) for(int i=0; i<(int)n;i++)
#define rep2(i,a,b) for(int i=(int)a; i<=(int)b; i++)

#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#define LL long long int
#define PII pair<int,int>
#define VI vector<int>
#define inf INT_MAX

using namespace std;

void FastIO()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
}

double dist(LL ax, LL ay, LL bx, LL by)
{
	double d=(ax-bx)*(ax-bx)+(ay-by)*(ay-by);
	return sqrt(d);
}

int main()
{
	FastIO();
	LL ax,ay,bx,by,tx,ty,n,x,y;
	double ans=0;
	vector< pair<double,int> > V;
	cin>>ax>>ay>>bx>>by>>tx>>ty>>n;
	for(int i=0;i<n;i++)
	{
		cin>>x>>y;
		double d=2*dist(tx,ty,x,y);
		double e=dist(ax,ay,x,y)+dist(x,y,tx,ty);
		double f=dist(bx,by,x,y)+dist(x,y,tx,ty);
		ans+=d;
		V.pb(mp(e-d,i));
		V.pb(mp(f-d,i));
	}
	sort(all(V));
	int k=V[0].s;
	ans+=V[0].f;
	for(int i=1;i<2*n;i++)
	{
		if(V[i].s!=k)
		{
			ans+=V[i].f;
			break;
		}
	}
	cout<<setprecision(10)<<fixed<<ans<<endl;
	return 0;
}


/*	 Hello World!	*/

#include <bits/stdc++.h>

#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define s second
#define let(x,a) __typeof(a) x(a)
#define all(a) (a).begin(),(a).end()
#define endl '\n'
#define present(c,x) ((c).find(x) != (c).end())
#define tr(v,it) for( let(it,v.begin()) ; it != v.end() ; it++)
#define rtr(v,it) for( let(it,v.rbegin()) ; it != v.rend() ; it++)
#define rep1(i,n) for(int i=0; i<(int)n;i++)
#define rep2(i,a,b) for(int i=(int)a; i<=(int)b; i++)

#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#define LL long long int
#define PII pair<int,int>
#define VI vector<int>
#define inf INT_MAX

using namespace std;

void FastIO()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
}

double dist(LL ax, LL ay, LL bx, LL by)
{
	double d=(ax-bx)*(ax-bx)+(ay-by)*(ay-by);
	return sqrt(d);
}

int main()
{
	FastIO();
	LL ax,ay,bx,by,tx,ty,n,x,y;
	double ans=0;
	vector< pair< pair<double,int>,int > > V1,V2;
	cin>>ax>>ay>>bx>>by>>tx>>ty>>n;
	for(int i=0;i<n;i++)
	{
		cin>>x>>y;
		double d=2*dist(tx,ty,x,y);
		double e=dist(ax,ay,x,y)+dist(x,y,tx,ty);
		double f=dist(bx,by,x,y)+dist(x,y,tx,ty);
		ans+=d;
		V1.pb(mp(mp(e-d,i),1));
		V2.pb(mp(mp(f-d,i),2));
	}
	sort(all(V1));
	sort(all(V2));
	double A=1e18;
	V2.pb(mp(mp(0,-1),2));
	for(int i=0;i<n;i++)
	{
		int k=0;
		while(V2[k].f.s==V1[i].f.s) k++;
		A=min(A,min(min(ans+V1[i].f.f,ans+V2[k].f.f),ans+V1[i].f.f+V2[k].f.f));
	}
	cout<<setprecision(10)<<fixed<<A<<endl;
	return 0;
}


/*	 Hello World!	*/

#include <bits/stdc++.h>

#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define s second
#define let(x,a) __typeof(a) x(a)
#define all(a) (a).begin(),(a).end()
#define endl '\n'
#define present(c,x) ((c).find(x) != (c).end())
#define tr(v,it) for( let(it,v.begin()) ; it != v.end() ; it++)
#define rtr(v,it) for( let(it,v.rbegin()) ; it != v.rend() ; it++)
#define rep1(i,n) for(int i=0; i<(int)n;i++)
#define rep2(i,a,b) for(int i=(int)a; i<=(int)b; i++)

#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#define LL long long int
#define PII pair<int,int>
#define VI vector<int>
#define inf INT_MAX

using namespace std;

void FastIO()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
}

double dist(LL ax, LL ay, LL bx, LL by)
{
	double d=(ax-bx)*(ax-bx)+(ay-by)*(ay-by);
	return sqrt(d);
}

int main()
{
	FastIO();
	LL ax,ay,bx,by,tx,ty,n,x,y;
	double ans=0;
	vector< pair< pair<double,int>,int > > V1,V2;
	cin>>ax>>ay>>bx>>by>>tx>>ty>>n;
	for(int i=0;i<n;i++)
	{
		cin>>x>>y;
		double d=2*dist(tx,ty,x,y);
		double e=dist(ax,ay,x,y)+dist(x,y,tx,ty);
		double f=dist(bx,by,x,y)+dist(x,y,tx,ty);
		ans+=d;
		V1.pb(mp(mp(e-d,i),1));
		V2.pb(mp(mp(f-d,i),2));
	}
	sort(all(V1));
	sort(all(V2));
	double A=1e18;
	V1.pb(mp(mp(1e9,-1),1));
	V2.pb(mp(mp(1e9,-1),2));
	for(int i=0;i<=n;i++)
	{
		int k=0;
		while(V2[k].f.s==V1[i].f.s) k++;
		A=min(A,min(min(ans+V1[i].f.f,ans+V2[k].f.f),ans+V1[i].f.f+V2[k].f.f));
	}
	cout<<setprecision(10)<<fixed<<A<<endl;
	return 0;
}


/*	 Hello World!	*/

#include <bits/stdc++.h>

#define pb push_back
#define pf push_front
#define mp make_pair
#define f first
#define s second
#define let(x,a) __typeof(a) x(a)
#define all(a) (a).begin(),(a).end()
#define endl '\n'
#define present(c,x) ((c).find(x) != (c).end())
#define tr(v,it) for( let(it,v.begin()) ; it != v.end() ; it++)
#define rtr(v,it) for( let(it,v.rbegin()) ; it != v.rend() ; it++)
#define rep1(i,n) for(int i=0; i<(int)n;i++)
#define rep2(i,a,b) for(int i=(int)a; i<=(int)b; i++)

#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#define LL long long int
#define PII pair<int,int>
#define VI vector<int>
#define inf INT_MAX

using namespace std;

void FastIO()
{
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
}

double dist(LL ax, LL ay, LL bx, LL by)
{
	double d=(ax-bx)*(ax-bx)+(ay-by)*(ay-by);
	return sqrt(d);
}

int main()
{
	FastIO();
	LL ax,ay,bx,by,tx,ty,n,x,y;
	double ans=0;
	vector< pair< pair<double,int>,int > > V1,V2;
	cin>>ax>>ay>>bx>>by>>tx>>ty>>n;
	for(int i=0;i<n;i++)
	{
		cin>>x>>y;
		double d=2*dist(tx,ty,x,y);
		double e=dist(ax,ay,x,y)+dist(x,y,tx,ty);
		double f=dist(bx,by,x,y)+dist(x,y,tx,ty);
		ans+=d;
		V1.pb(mp(mp(e-d,i),1));
		V2.pb(mp(mp(f-d,i),2));
	}
	sort(all(V1));
	sort(all(V2));
	double A=1e18;
	for(int i=0;i<n;i++)
	{
		int k=0;
		while(V2[k].f.s==V1[i].f.s) k++;
		A=min(A,min(min(ans+V1[i].f.f,ans+V2[k].f.f),ans+V1[i].f.f+V2[k].f.f));
	}
	cout<<setprecision(10)<<fixed<<A<<endl;
	return 0;
}


#include<bits/stdc++.h>
#define LL long long
using namespace std;
const long double eps=1e-10;
int dcmp(long double x)
{
    if(fabs(x)<eps) return 0;
    if(x<0)return -1;
    else return 1;
}
const LL maxn=100005;
LL ax,ay,bx,by,tx,ty;
LL n;
LL x[maxn],y[maxn];
long double d[maxn][5];
long double sqr(long double x){return x*x;}
int main()
{
//    freopen("input.txt","r",stdin);
    while(cin>>ax>>ay>>bx>>by>>tx>>ty)
    {
        cin>>n;
        for(LL i=0;i<n;i++)scanf("%I64d%I64d",&x[i],&y[i]);
        long double ans=0;
        for(LL i=0;i<n;i++)
        {
            d[i][0]=sqrt(sqr((ax-x[i])*1.0)+sqr((ay-y[i])*1.0));
            d[i][1]=sqrt(sqr((bx-x[i])*1.0)+sqr((by-y[i])*1.0));
            d[i][2]=sqrt(sqr((tx-x[i])*1.0)+sqr((ty-y[i])*1.0));
            ans+=2*d[i][2];
        }
        long double plus1=d[0][0]-d[0][2];
        int id=0;
        for(LL i=1;i<n;i++)
            if(dcmp(d[i][0]-d[i][2]-plus1)<0)
            {
                plus1=d[i][0]-d[i][2];
                id=i;
            }
        long double plus2;
        if(id)
            plus2=d[0][1]-d[0][2];
        else
        {
            if(n==1)plus2=0;
            else plus2=d[1][1]-d[1][2];
        }
        for(LL i=0;i<n;i++)
        {
            if(i==id)continue;
            if(dcmp(d[i][1]-d[i][2]-plus2)<0)
            {
                plus2=d[i][1]-d[i][2];
            }
        }
        long double add=plus1+plus2;
        plus1=d[0][1]-d[0][2];
        id=0;
        for(LL i=1;i<n;i++)
            if(dcmp(d[i][1]-d[i][2]-plus1)<0)
            {
                plus1=d[i][1]-d[i][2];
                id=i;
            }
        if(id)
            plus2=d[0][0]-d[0][2];
        else
        {
            if(n==1)plus2=0;
            else plus2=d[1][0]-d[1][2];
        }
        for(LL i=0;i<n;i++)
        {
            if(i==id)continue;
            if(dcmp(d[i][0]-d[i][2]-plus2)<0)
            {
                plus2=d[i][0]-d[i][2];
            }
        }
        if(dcmp(plus1+plus2-add)<0)add=plus1+plus2;
        printf("%.12f\n",(double)(ans+add));
    }
    return 0;
}


#include<bits/stdc++.h>
#define LL long long
using namespace std;
const double eps=1e-10;
int dcmp(double x)
{
    if(fabs(x)<eps) return 0;
    else return (x>eps)-(x<-eps);
}
const LL maxn=100005;
LL ax,ay,bx,by,tx,ty;
LL n;
LL x[maxn],y[maxn];
double d[maxn][5];
double sqr(LL x){return x*1.0*x;}
int main()
{
//	freopen("input.txt","r",stdin);
//	freopen("output1.txt","w",stdout);
    while(cin>>ax>>ay>>bx>>by>>tx>>ty)
    {
        cin>>n;
        for(LL i=0;i<n;i++)scanf("%I64d%I64d",&x[i],&y[i]);
        double ans=0;
        for(LL i=0;i<n;i++)
        {
            d[i][0]=sqrt((ax-x[i])*1.0*(ax-x[i])+(ay-y[i])*1.0*(ay-y[i]));
            d[i][1]=sqrt((bx-x[i])*1.0*(bx-x[i])+(by-y[i])*1.0*(by-y[i]));
            d[i][2]=sqrt((tx-x[i])*1.0*(tx-x[i])+(ty-y[i])*1.0*(ty-y[i]));
            ans+=2.0*d[i][2];
        }
        double plus1=d[0][0]-d[0][2];
        int id=0;
        for(LL i=1;i<n;i++)
            if(dcmp(d[i][0]-d[i][2]-plus1)<0)
            {
                plus1=d[i][0]-d[i][2];
                id=i;
            }
        double plus2=0;
        for(LL i=0;i<n;i++)
        {
            if(i==id)continue;
            if(dcmp(d[i][1]-d[i][2]-plus2)<0)
            {
                plus2=d[i][1]-d[i][2];
            }
        }
        double add=plus1+plus2;
        plus1=d[0][1]-d[0][2];
        id=0;
        for(LL i=1;i<n;i++)
            if(dcmp(d[i][1]-d[i][2]-plus1)<0)
            {
                plus1=d[i][1]-d[i][2];
                id=i;
            }
        plus2=0;
        for(LL i=0;i<n;i++)
        {
            if(i==id)continue;
            if(dcmp(d[i][0]-d[i][2]-plus2)<0)
            {
                plus2=d[i][0]-d[i][2];
            }
        }
        if(dcmp(plus1+plus2-add)<0)add=plus1+plus2;
        printf("%.12f\n",(double)(ans+add));
    }
    return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define eps 1e-10
using namespace std;
int dcmp(double x)
{
    if(fabs(x)<eps)return 0;
    else return (x>eps)-(x<-eps);
}
const LL maxn=100005;
LL ax,ay,bx,by,tx,ty;
LL n;
LL x[maxn],y[maxn];
struct Option
{
    LL d,id;
    Option(LL d=0,LL id=0):d(d),id(id){}
    bool operator < (const Option& rhs) const
    {
        return d<rhs.d;
    }
};
vector<Option> G[2];
LL d[maxn][3];
LL sqr(LL x){return x*x;}
int main()
{
//    freopen("input.txt","r",stdin);
    while(cin>>ax>>ay>>bx>>by>>tx>>ty)
    {
        cin>>n;
        for(LL i=0;i<n;i++)scanf("%I64d%I64d",&x[i],&y[i]);
        double ans=0;
        for(LL i=0;i<n;i++)
        {
            d[i][0]=sqr(ax-x[i])+sqr(ay-y[i]);
            d[i][1]=sqr(bx-x[i])+sqr(by-y[i]);
            d[i][2]=sqr(tx-x[i])+sqr(ty-y[i]);
            ans+=2*sqrtl(d[i][2]);
        }
        double plus1=sqrtl(d[0][0])-sqrtl(d[0][2]),id=0;
        for(LL i=1;i<n;i++)
            if(dcmp(sqrtl(d[i][0])-sqrtl(d[i][2])-plus1)<0)
            {
                plus1=sqrtl(d[i][0])-sqrtl(d[i][2]);
                id=i;
            }
        double plus2;
        if(id)
            plus2=sqrtl(d[0][1])-sqrtl(d[0][2]);
        else
        {
            if(n==1)plus2=0;
            else plus2=sqrtl(d[1][1])-sqrtl(d[1][2]);
        }
        for(LL i=0;i<n;i++)
        {
            if(i==id)continue;
            if(dcmp(sqrtl(d[i][1])-sqrtl(d[i][2])-plus2)<0)
            {
                plus2=sqrtl(d[i][1])-sqrtl(d[i][2]);
            }
        }
        double add=plus1+plus2;
        plus1=sqrtl(d[0][1])-sqrtl(d[0][2]),id=0;
        for(LL i=1;i<n;i++)
            if(dcmp(sqrtl(d[i][1])-sqrtl(d[i][2])-plus1)<0)
            {
                plus1=sqrtl(d[i][1])-sqrtl(d[i][2]);
                id=i;
            }
        if(id)
            plus2=sqrtl(d[0][0])-sqrtl(d[0][2]);
        else
        {
            if(n==1)plus2=0;
            else plus2=sqrtl(d[1][0])-sqrtl(d[1][2]);
        }
        for(LL i=0;i<n;i++)
        {
            if(i==id)continue;
            if(dcmp(sqrtl(d[i][0])-sqrtl(d[i][2])-plus2)<0)
            {
                plus2=sqrtl(d[i][0])-sqrtl(d[i][2]);
            }
        }
        if(dcmp(plus1+plus2-add)<0)add=plus1+plus2;
        printf("%.12f\n",ans+add);
    }
    return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define eps 1e-10
using namespace std;
int dcmp(double x)
{
    if(fabs(x)<eps)return 0;
    else return (x>eps)-(x<-eps);
}
const LL maxn=100005;
LL ax,ay,bx,by,tx,ty;
LL n;
LL x[maxn],y[maxn];
struct Option
{
    LL d,id;
    Option(LL d=0,LL id=0):d(d),id(id){}
    bool operator < (const Option& rhs) const
    {
        return d<rhs.d;
    }
};
vector<Option> G[2];
LL d[maxn][3];
LL sqr(LL x){return x*x;}
int main()
{
//    freopen("input.txt","r",stdin);
    while(cin>>ax>>ay>>bx>>by>>tx>>ty)
    {
        cin>>n;
        for(LL i=0;i<n;i++)scanf("%I64d%I64d",&x[i],&y[i]);
        double ans=0;
        for(LL i=0;i<n;i++)
        {
            d[i][0]=sqr(ax-x[i])+sqr(ay-y[i]);
            d[i][1]=sqr(bx-x[i])+sqr(by-y[i]);
            d[i][2]=sqr(tx-x[i])+sqr(ty-y[i]);
            ans+=2*sqrt(d[i][2]);
        }
        double plus1=sqrt(d[0][0])-sqrt(d[0][2]),id=0;
        for(LL i=1;i<n;i++)
            if(dcmp(sqrt(d[i][0])-sqrt(d[i][2])-plus1)<0)
            {
                plus1=sqrt(d[i][0])-sqrt(d[i][2]);
                id=i;
            }
        double plus2;
        if(id)
            plus2=sqrt(d[0][1])-sqrt(d[0][2]);
        else
        {
            if(n==1)plus2=0;
            else plus2=sqrt(d[1][1])-sqrt(d[1][2]);
        }
        for(LL i=0;i<n;i++)
        {
            if(i==id)continue;
            if(dcmp(sqrt(d[i][1])-sqrt(d[i][2])-plus2)<0)
            {
                plus2=sqrt(d[i][1])-sqrt(d[i][2]);
            }
        }
        double add=plus1+plus2;
        plus1=sqrt(d[0][1])-sqrt(d[0][2]),id=0;
        for(LL i=1;i<n;i++)
            if(dcmp(sqrt(d[i][1])-sqrt(d[i][2])-plus1)<0)
            {
                plus1=sqrt(d[i][1])-sqrt(d[i][2]);
                id=i;
            }
        if(id)
            plus2=sqrt(d[0][0])-sqrt(d[0][2]);
        else
        {
            if(n==1)plus2=0;
            else plus2=sqrt(d[1][0])-sqrt(d[1][2]);
        }
        for(LL i=0;i<n;i++)
        {
            if(i==id)continue;
            if(dcmp(sqrt(d[i][0])-sqrt(d[i][2])-plus2)<0)
            {
                plus2=sqrt(d[i][0])-sqrt(d[i][2]);
            }
        }
        if(dcmp(plus1+plus2-add)<0)add=plus1+plus2;
        printf("%.12f\n",ans+add);
    }
    return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define eps 1e-8
using namespace std;
int dcmp(double x)
{
    if(fabs(x)<eps)return 0;
    else return (x>eps)-(x<-eps);
}
const LL maxn=100005;
double ax,ay,bx,by,tx,ty;
LL n;
double x[maxn],y[maxn];
double d[maxn][3];
double sqr(double x){return x*x;}
int main()
{
//    freopen("input.txt","r",stdin);
    while(cin>>ax>>ay>>bx>>by>>tx>>ty)
    {
        cin>>n;
        for(LL i=0;i<n;i++)scanf("%lf%lf",&x[i],&y[i]);
        double ans=0;
        for(LL i=0;i<n;i++)
        {
            d[i][0]=sqrt(sqr(ax-x[i])+sqr(ay-y[i]));
            d[i][1]=sqrt(sqr(bx-x[i])+sqr(by-y[i]));
            d[i][2]=sqrt(sqr(tx-x[i])+sqr(ty-y[i]));
            ans+=2*d[i][2];
        }
        double plus1=d[0][0]-d[0][2];
        int id=0;
        for(LL i=1;i<n;i++)
            if(dcmp(d[i][0]-d[i][2]-plus1)<0)
            {
                plus1=d[i][0]-d[i][2];
                id=i;
            }
        double plus2;
        if(id)
            plus2=d[0][1]-d[0][2];
        else
        {
            if(n==1)plus2=0;
            else plus2=d[1][1]-d[1][2];
        }
        for(LL i=0;i<n;i++)
        {
            if(i==id)continue;
            if(dcmp(d[i][1]-d[i][2]-plus2)<0)
            {
                plus2=d[i][1]-d[i][2];
            }
        }
        double add=plus1+plus2;
        plus1=d[0][1]-d[0][2];
        id=0;
        for(LL i=1;i<n;i++)
            if(dcmp(d[i][1]-d[i][2]-plus1)<0)
            {
                plus1=d[i][1]-d[i][2];
                id=i;
            }
        if(id)
            plus2=d[0][0]-d[0][2];
        else
        {
            if(n==1)plus2=0;
            else plus2=d[1][0]-d[1][2];
        }
        for(LL i=0;i<n;i++)
        {
            if(i==id)continue;
            if(dcmp(d[i][0]-d[i][2]-plus2)<0)
            {
                plus2=d[i][0]-d[i][2];
            }
        }
        if(dcmp(plus1+plus2-add)<0)add=plus1+plus2;
        printf("%.12f\n",ans+add);
    }
    return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define eps 1e-13
using namespace std;
int dcmp(double x)
{
    if(fabs(x)<eps)return 0;
    else return (x>eps)-(x<-eps);
}
const LL maxn=100005;
LL ax,ay,bx,by,tx,ty;
LL n;
LL x[maxn],y[maxn];
LL d[maxn][3];
LL sqr(LL x){return x*x;}
int main()
{
//    freopen("input.txt","r",stdin);
    while(cin>>ax>>ay>>bx>>by>>tx>>ty)
    {
        cin>>n;
        for(LL i=0;i<n;i++)scanf("%I64d%I64d",&x[i],&y[i]);
        double ans=0;
        for(LL i=0;i<n;i++)
        {
            d[i][0]=sqr(ax-x[i])+sqr(ay-y[i]);
            d[i][1]=sqr(bx-x[i])+sqr(by-y[i]);
            d[i][2]=sqr(tx-x[i])+sqr(ty-y[i]);
            ans+=2*sqrtl(d[i][2]);
        }
        double plus1=sqrtl(d[0][0])-sqrtl(d[0][2]);
        int id=0;
        for(LL i=1;i<n;i++)
            if(dcmp(sqrtl(d[i][0])-sqrtl(d[i][2])-plus1)<0)
            {
                plus1=sqrtl(d[i][0])-sqrtl(d[i][2]);
                id=i;
            }
        double plus2;
        if(id)
            plus2=sqrtl(d[0][1])-sqrtl(d[0][2]);
        else
        {
            if(n==1)plus2=0;
            else plus2=sqrtl(d[1][1])-sqrtl(d[1][2]);
        }
        for(LL i=0;i<n;i++)
        {
            if(i==id)continue;
            if(dcmp(sqrtl(d[i][1])-sqrtl(d[i][2])-plus2)<0)
            {
                plus2=sqrtl(d[i][1])-sqrtl(d[i][2]);
            }
        }
        double add=plus1+plus2;
        plus1=sqrtl(d[0][1])-sqrtl(d[0][2]),id=0;
        for(LL i=1;i<n;i++)
            if(dcmp(sqrtl(d[i][1])-sqrtl(d[i][2])-plus1)<0)
            {
                plus1=sqrtl(d[i][1])-sqrtl(d[i][2]);
                id=i;
            }
        if(id)
            plus2=sqrtl(d[0][0])-sqrtl(d[0][2]);
        else
        {
            if(n==1)plus2=0;
            else plus2=sqrtl(d[1][0])-sqrtl(d[1][2]);
        }
        for(LL i=0;i<n;i++)
        {
            if(i==id)continue;
            if(dcmp(sqrtl(d[i][0])-sqrtl(d[i][2])-plus2)<0)
            {
                plus2=sqrtl(d[i][0])-sqrtl(d[i][2]);
            }
        }
        if(dcmp(plus1+plus2-add)<0)add=plus1+plus2;
        printf("%.12lf\n",ans+add);
    }
    return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define eps 1e-13
using namespace std;
int dcmp(double x)
{
    if(fabs(x)<eps)return 0;
    else return (x>eps)-(x<-eps);
}
const LL maxn=100005;
LL ax,ay,bx,by,tx,ty;
LL n;
LL x[maxn],y[maxn];
struct Option
{
    LL d,id;
    Option(LL d=0,LL id=0):d(d),id(id){}
    bool operator < (const Option& rhs) const
    {
        return d<rhs.d;
    }
};
vector<Option> G[2];
LL d[maxn][3];
LL sqr(LL x){return x*x;}
int main()
{
//    freopen("input.txt","r",stdin);
    while(cin>>ax>>ay>>bx>>by>>tx>>ty)
    {
        cin>>n;
        for(LL i=0;i<n;i++)scanf("%I64d%I64d",&x[i],&y[i]);
        double ans=0;
        for(LL i=0;i<n;i++)
        {
            d[i][0]=sqr(ax-x[i])+sqr(ay-y[i]);
            d[i][1]=sqr(bx-x[i])+sqr(by-y[i]);
            d[i][2]=sqr(tx-x[i])+sqr(ty-y[i]);
            ans+=2*sqrtl(d[i][2]);
        }
        double plus1=sqrtl(d[0][0])-sqrtl(d[0][2]);int id=0;
        for(LL i=1;i<n;i++)
            if(dcmp(sqrtl(d[i][0])-sqrtl(d[i][2])-plus1)<0)
            {
                plus1=sqrtl(d[i][0])-sqrtl(d[i][2]);
                id=i;
            }
        double plus2;
        if(id)
            plus2=sqrtl(d[0][1])-sqrtl(d[0][2]);
        else
        {
            if(n==1)plus2=0;
            else plus2=sqrtl(d[1][1])-sqrtl(d[1][2]);
        }
        for(LL i=0;i<n;i++)
        {
            if(i==id)continue;
            if(dcmp(sqrtl(d[i][1])-sqrtl(d[i][2])-plus2)<0)
            {
                plus2=sqrtl(d[i][1])-sqrtl(d[i][2]);
            }
        }
        double add=plus1+plus2;
        plus1=sqrtl(d[0][1])-sqrtl(d[0][2]),id=0;
        for(LL i=1;i<n;i++)
            if(dcmp(sqrtl(d[i][1])-sqrtl(d[i][2])-plus1)<0)
            {
                plus1=sqrtl(d[i][1])-sqrtl(d[i][2]);
                id=i;
            }
        if(id)
            plus2=sqrtl(d[0][0])-sqrtl(d[0][2]);
        else
        {
            if(n==1)plus2=0;
            else plus2=sqrtl(d[1][0])-sqrtl(d[1][2]);
        }
        for(LL i=0;i<n;i++)
        {
            if(i==id)continue;
            if(dcmp(sqrtl(d[i][0])-sqrtl(d[i][2])-plus2)<0)
            {
                plus2=sqrtl(d[i][0])-sqrtl(d[i][2]);
            }
        }
        if(dcmp(plus1+plus2-add)<0)add=plus1+plus2;
        printf("%.12f\n",ans+add);
    }
    return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define eps 1e-13
using namespace std;
int dcmp(double x)
{
    if(fabs(x)<eps)return 0;
    else return (x>eps)-(x<-eps);
}
const LL maxn=100005;
double ax,ay,bx,by,tx,ty;
LL n;
double x[maxn],y[maxn];
double d[maxn][3];
double sqr(double x){return x*x;}
int main()
{
//    freopen("input.txt","r",stdin);
    while(cin>>ax>>ay>>bx>>by>>tx>>ty)
    {
        cin>>n;
        for(LL i=0;i<n;i++)scanf("%lf%lf",&x[i],&y[i]);
        double ans=0;
        for(LL i=0;i<n;i++)
        {
            d[i][0]=sqrt(sqr(ax-x[i])+sqr(ay-y[i]));
            d[i][1]=sqrt(sqr(bx-x[i])+sqr(by-y[i]));
            d[i][2]=sqrt(sqr(tx-x[i])+sqr(ty-y[i]));
            ans+=2*d[i][2];
        }
        double plus1=d[0][0]-d[0][2];
        int id=0;
        for(LL i=1;i<n;i++)
            if(dcmp(d[i][0]-d[i][2]-plus1)<0)
            {
                plus1=d[i][0]-d[i][2];
                id=i;
            }
        double plus2;
        if(id)
            plus2=d[0][1]-d[0][2];
        else
        {
            if(n==1)plus2=0;
            else plus2=d[1][1]-d[1][2];
        }
        for(LL i=0;i<n;i++)
        {
            if(i==id)continue;
            if(dcmp(d[i][1]-d[i][2]-plus2)<0)
            {
                plus2=d[i][1]-d[i][2];
            }
        }
        double add=plus1+plus2;
        plus1=d[0][1]-d[0][2];
        id=0;
        for(LL i=1;i<n;i++)
            if(dcmp(d[i][1]-d[i][2]-plus1)<0)
            {
                plus1=d[i][1]-d[i][2];
                id=i;
            }
        if(id)
            plus2=d[0][0]-d[0][2];
        else
        {
            if(n==1)plus2=0;
            else plus2=d[1][0]-d[1][2];
        }
        for(LL i=0;i<n;i++)
        {
            if(i==id)continue;
            if(dcmp(d[i][0]-d[i][2]-plus2)<0)
            {
                plus2=d[i][0]-d[i][2];
            }
        }
        if(dcmp(plus1+plus2-add)<0)add=plus1+plus2;
        printf("%.12f\n",ans+add);
    }
    return 0;
}


#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <string>
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define fur(i,a,b) for(int i=(a);i<=(b);i++)
#define furr(i,a,b) for(int i=(a);i>=(b);i--)
#define cl(a) memset((a),0,sizeof(a))
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define sc(x) scanf("%d",&x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;
const int inf=0x3f3f3f3f;
const double eps=1e-8;
const int mod=1000000007;
const double pi=acos(-1);
inline void gn(long long&x){
    int sg=1;char c;while(((c=getchar())<'0'||c>'9')&&c!='-');c=='-'?(sg=-1,x=0):(x=c-'0');
    while((c=getchar())>='0'&&c<='9')x=x*10+c-'0';x*=sg;
}
inline void gn(int&x){long long t;gn(t);x=t;}
inline void gn(unsigned long long&x){long long t;gn(t);x=t;}
inline void gn(double&x){double t;scanf("%lf",&t);x=t;}
inline void gn(long double&x){double t;scanf("%lf",&t);x=t;}
int gcd(int a,int b){return a? gcd(b%a,a):b;}
ll powmod(ll a,ll x,ll mod){ll t=1ll;while(x){if(x&1)t=t*a%mod;a=a*a%mod;x>>=1;}return t;}
struct Node{
	int x,y;
}pa,pb,p,tmp;
double	getdis(Node a,Node b){
	return sqrt((a.x-b.x)*1.0*(a.x-b.x)+(a.y-b.y)*1.0*(a.y-b.y));
}
double dis[3][1000005];
int main(){
//	freopen("input.txt","r",stdin);
//	freopen("output2.txt","w",stdout);
	while(cin>>pa.x>>pa.y>>pb.x>>pb.y>>p.x>>p.y)
    {
        int n;
        dis[0][0] = dis [1][0] = dis[2][0] = 0;
        double tot=0;
        gn(n);
        fur(i,1,n){
            gn(tmp.x);gn(tmp.y);
            dis[0][i] = getdis(tmp,pa);
            dis[1][i] = getdis(tmp,pb);
            dis[2][i] = getdis(tmp,p);
            tot+=(dis[2][i]*2);
        }
        double add1 = 1e18;
        int id = 0;
        fur(i,1,n)
            if(dis[0][i]-dis[2][i]<add1){
                add1 = dis[0][i]-dis[2][i];
                id = i;
            }
        double add2 = dis[1][0]-dis[2][0];
        fur(i,1,n)
            if(i == id)continue;
            else if(dis[1][i]-dis[2][i]<add2){
                add2 = dis[1][i]-dis[2][i];
            }

        double plus = add1+add2;
        add1 = 1e18;
        id = 0;
        fur(i,1,n)
            if(dis[1][i]-dis[2][i]<add1){
                add1 = dis[1][i]-dis[2][i];
                id = i;
            }
        add2 = dis[0][0]-dis[2][0];
        fur(i,0,n)
            if(i == id)continue;
            else if(dis[0][i]-dis[2][i]<add2){
                add2 = dis[0][i]-dis[2][i];
            }

        if(add1+add2<plus){
            plus = add1+add2;
        }
        printf("%lf\n",tot+plus);

    }
	return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define eps 1e-13
using namespace std;
int dcmp(double x)
{
    if(fabs(x)<eps)return 0;
    else return (x>eps)-(x<-eps);
}
const LL maxn=100005;
LL ax,ay,bx,by,tx,ty;
LL n;
LL x[maxn],y[maxn];
struct Option
{
    LL d,id;
    Option(LL d=0,LL id=0):d(d),id(id){}
    bool operator < (const Option& rhs) const
    {
        return d<rhs.d;
    }
};
vector<Option> G[2];
LL d[maxn][3];
LL sqr(LL x){return x*x;}
int main()
{
//    freopen("input.txt","r",stdin);
    while(cin>>ax>>ay>>bx>>by>>tx>>ty)
    {
        cin>>n;
        for(LL i=0;i<n;i++)scanf("%I64d%I64d",&x[i],&y[i]);
        double ans=0;
        for(LL i=0;i<n;i++)
        {
            d[i][0]=sqr(ax-x[i])+sqr(ay-y[i]);
            d[i][1]=sqr(bx-x[i])+sqr(by-y[i]);
            d[i][2]=sqr(tx-x[i])+sqr(ty-y[i]);
            ans+=2*sqrtl(d[i][2]);
        }
        double plus1=sqrtl(d[0][0])-sqrtl(d[0][2]),id=0;
        for(LL i=1;i<n;i++)
            if(dcmp(sqrtl(d[i][0])-sqrtl(d[i][2])-plus1)<0)
            {
                plus1=sqrtl(d[i][0])-sqrtl(d[i][2]);
                id=i;
            }
        double plus2;
        if(id)
            plus2=sqrtl(d[0][1])-sqrtl(d[0][2]);
        else
        {
            if(n==1)plus2=0;
            else plus2=sqrtl(d[1][1])-sqrtl(d[1][2]);
        }
        for(LL i=0;i<n;i++)
        {
            if(i==id)continue;
            if(dcmp(sqrtl(d[i][1])-sqrtl(d[i][2])-plus2)<0)
            {
                plus2=sqrtl(d[i][1])-sqrtl(d[i][2]);
            }
        }
        double add=plus1+plus2;
        plus1=sqrtl(d[0][1])-sqrtl(d[0][2]),id=0;
        for(LL i=1;i<n;i++)
            if(dcmp(sqrtl(d[i][1])-sqrtl(d[i][2])-plus1)<0)
            {
                plus1=sqrtl(d[i][1])-sqrtl(d[i][2]);
                id=i;
            }
        if(id)
            plus2=sqrtl(d[0][0])-sqrtl(d[0][2]);
        else
        {
            if(n==1)plus2=0;
            else plus2=sqrtl(d[1][0])-sqrtl(d[1][2]);
        }
        for(LL i=0;i<n;i++)
        {
            if(i==id)continue;
            if(dcmp(sqrtl(d[i][0])-sqrtl(d[i][2])-plus2)<0)
            {
                plus2=sqrtl(d[i][0])-sqrtl(d[i][2]);
            }
        }
        if(dcmp(plus1+plus2-add)<0)add=plus1+plus2;
        printf("%.12f\n",ans+add);
    }
    return 0;
}


#include<bits/stdc++.h>
#define LL long long
using namespace std;
const long double eps=1e-10;
int dcmp(long double x){if(fabs(x)<eps) return 0;return (x>eps)-(x<-eps);}
const LL maxn=100005;
LL ax,ay,bx,by,tx,ty;
LL n;
LL x[maxn],y[maxn];
long double d[maxn][5];
long double sqr(long double x){return x*x;}
int main()
{
//    freopen("input.txt","r",stdin);
    while(cin>>ax>>ay>>bx>>by>>tx>>ty)
    {
        cin>>n;
        for(LL i=0;i<n;i++)scanf("%I64d%I64d",&x[i],&y[i]);
        long double ans=0;
        for(LL i=0;i<n;i++)
        {
            d[i][0]=sqrt(sqr((ax-x[i])*1.0)+sqr((ay-y[i])*1.0));
            d[i][1]=sqrt(sqr((bx-x[i])*1.0)+sqr((by-y[i])*1.0));
            d[i][2]=sqrt(sqr((tx-x[i])*1.0)+sqr((ty-y[i])*1.0));
            ans+=2*d[i][2];
        }
        long double plus1=d[0][0]-d[0][2];
        int id=0;
        for(LL i=1;i<n;i++)
            if(dcmp(d[i][0]-d[i][2]-plus1)<0)
            {
                plus1=d[i][0]-d[i][2];
                id=i;
            }
        long double plus2;
        if(id)
            plus2=d[0][1]-d[0][2];
        else
        {
            if(n==1)plus2=0;
            else plus2=d[1][1]-d[1][2];
        }
        for(LL i=0;i<n;i++)
        {
            if(i==id)continue;
            if(dcmp(d[i][1]-d[i][2]-plus2)<0)
            {
                plus2=d[i][1]-d[i][2];
            }
        }
        long double add=plus1+plus2;
        plus1=d[0][1]-d[0][2];
        id=0;
        for(LL i=1;i<n;i++)
            if(dcmp(d[i][1]-d[i][2]-plus1)<0)
            {
                plus1=d[i][1]-d[i][2];
                id=i;
            }
        if(id)
            plus2=d[0][0]-d[0][2];
        else
        {
            if(n==1)plus2=0;
            else plus2=d[1][0]-d[1][2];
        }
        for(LL i=0;i<n;i++)
        {
            if(i==id)continue;
            if(dcmp(d[i][0]-d[i][2]-plus2)<0)
            {
                plus2=d[i][0]-d[i][2];
            }
        }
        if(dcmp(plus1+plus2-add)<0)add=plus1+plus2;
        printf("%.12f\n",(double)(ans+add));
    }
    return 0;
}


#include<bits/stdc++.h>
#define LL long long
#define eps 1e-13
using namespace std;
int dcmp(double x)
{
    if(fabs(x)<eps)return 0;
    else return (x>eps)-(x<-eps);
}
const LL maxn=100005;
double ax,ay,bx,by,tx,ty;
LL n;
double x[maxn],y[maxn];
double d[maxn][3];
double sqr(double x){return x*x;}
int main()
{
//    freopen("input.txt","r",stdin);
    while(cin>>ax>>ay>>bx>>by>>tx>>ty)
    {
        cin>>n;
        for(LL i=0;i<n;i++)scanf("%lf%lf",&x[i],&y[i]);
        double ans=0;
        for(LL i=0;i<n;i++)
        {
            d[i][0]=sqr(ax-x[i])+sqr(ay-y[i]);
            d[i][1]=sqr(bx-x[i])+sqr(by-y[i]);
            d[i][2]=sqr(tx-x[i])+sqr(ty-y[i]);
            ans+=2*sqrtl(d[i][2]);
        }
        double plus1=sqrtl(d[0][0])-sqrtl(d[0][2]);
        int id=0;
        for(LL i=1;i<n;i++)
            if(dcmp(sqrtl(d[i][0])-sqrtl(d[i][2])-plus1)<0)
            {
                plus1=sqrtl(d[i][0])-sqrtl(d[i][2]);
                id=i;
            }
        double plus2;
        if(id)
            plus2=sqrtl(d[0][1])-sqrtl(d[0][2]);
        else
        {
            if(n==1)plus2=0;
            else plus2=sqrtl(d[1][1])-sqrtl(d[1][2]);
        }
        for(LL i=0;i<n;i++)
        {
            if(i==id)continue;
            if(dcmp(sqrtl(d[i][1])-sqrtl(d[i][2])-plus2)<0)
            {
                plus2=sqrtl(d[i][1])-sqrtl(d[i][2]);
            }
        }
        double add=plus1+plus2;
        plus1=sqrtl(d[0][1])-sqrtl(d[0][2]),id=0;
        for(LL i=1;i<n;i++)
            if(dcmp(sqrtl(d[i][1])-sqrtl(d[i][2])-plus1)<0)
            {
                plus1=sqrtl(d[i][1])-sqrtl(d[i][2]);
                id=i;
            }
        if(id)
            plus2=sqrtl(d[0][0])-sqrtl(d[0][2]);
        else
        {
            if(n==1)plus2=0;
            else plus2=sqrtl(d[1][0])-sqrtl(d[1][2]);
        }
        for(LL i=0;i<n;i++)
        {
            if(i==id)continue;
            if(dcmp(sqrtl(d[i][0])-sqrtl(d[i][2])-plus2)<0)
            {
                plus2=sqrtl(d[i][0])-sqrtl(d[i][2]);
            }
        }
        if(dcmp(plus1+plus2-add)<0)add=plus1+plus2;
        printf("%.12f\n",ans+add);
    }
    return 0;
}


#include<bits/stdc++.h>
#define LL long long
using namespace std;
const double eps=1e-10;
int dcmp(double x){if(fabs(x)<eps) return 0;return (x>eps)-(x<-eps);}
const LL maxn=100005;
double ax,ay,bx,by,tx,ty;
LL n;
double x[maxn],y[maxn];
double d[maxn][5];
double sqr(double x){return x*x;}
int main()
{
//    freopen("input.txt","r",stdin);
    while(cin>>ax>>ay>>bx>>by>>tx>>ty)
    {
        cin>>n;
        for(LL i=0;i<n;i++)scanf("%lf%lf",&x[i],&y[i]);
        double ans=0;
        for(LL i=0;i<n;i++)
        {
            d[i][0]=sqrt(sqr(ax-x[i])+sqr(ay-y[i]));
            d[i][1]=sqrt(sqr(bx-x[i])+sqr(by-y[i]));
            d[i][2]=sqrt(sqr(tx-x[i])+sqr(ty-y[i]));
            ans+=2*d[i][2];
        }
        double plus1=d[0][0]-d[0][2];
        int id=0;
        for(LL i=1;i<n;i++)
            if(dcmp(d[i][0]-d[i][2]-plus1)<0)
            {
                plus1=d[i][0]-d[i][2];
                id=i;
            }
        double plus2;
        if(id)
            plus2=d[0][1]-d[0][2];
        else
        {
            if(n==1)plus2=0;
            else plus2=d[1][1]-d[1][2];
        }
        for(LL i=0;i<n;i++)
        {
            if(i==id)continue;
            if(dcmp(d[i][1]-d[i][2]-plus2)<0)
            {
                plus2=d[i][1]-d[i][2];
            }
        }
        double add=plus1+plus2;
        plus1=d[0][1]-d[0][2];
        id=0;
        for(LL i=1;i<n;i++)
            if(dcmp(d[i][1]-d[i][2]-plus1)<0)
            {
                plus1=d[i][1]-d[i][2];
                id=i;
            }
        if(id)
            plus2=d[0][0]-d[0][2];
        else
        {
            if(n==1)plus2=0;
            else plus2=d[1][0]-d[1][2];
        }
        for(LL i=0;i<n;i++)
        {
            if(i==id)continue;
            if(dcmp(d[i][0]-d[i][2]-plus2)<0)
            {
                plus2=d[i][0]-d[i][2];
            }
        }
        if(dcmp(plus1+plus2-add)<0)add=plus1+plus2;
        printf("%.12f\n",ans+add);
    }
    return 0;
}


#include <cstdlib>
#include <iostream>
#include <string.h>
#include <iomanip>
#include <fstream>
#include <vector>
#include <math.h>
#include <climits>
#include <stdio.h>
using namespace std;

int main()
{
    long long ax,ay,bx,by,tx,ty,x,y,m1,m2,m3,m4;
    long double mdis1=0,mdis2=0,sum,temp1,temp2,mdis3=0,mdis4=0,sum2,temp;
    int n;
    sum=0;
    m1=m2=m3=m4=-1;
    cin>>ax>>ay>>bx>>by>>tx>>ty;
    ax=ax*10;
    ay=ay*10;
    bx=bx*10;
    by=by*10;
    tx=tx*10;
    ty=ty*10;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>y;
        x=x*10;
        y=y*10;
        temp1=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y))-sqrtl((ax-x)*(ax-x)+(ay-y)*(ay-y));
        temp2=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y))-sqrtl((bx-x)*(bx-x)+(by-y)*(by-y));
        if(temp1>mdis1)
        {
            mdis2=mdis1;
            mdis1=temp1;
            m2=m1;
            m1=i;
        }
        else if(temp1>mdis2)
        {
            mdis2=temp1;
            m2=i;
        }
        if(temp2>mdis3)
        {
            mdis4=mdis3;
            mdis3=temp2;
            m3=i;
        }
        else if(temp2>mdis4)
        {
            mdis4=temp2;
            m4=i;
        }
        sum+=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y));
    }
   // cout<<sum+sum-mdis1-mdis3;
    if(m1!=m3)
    {
        cout<< setprecision(20)<<(sum+sum-mdis1-mdis3)/10;
        //printf("%Lf\n",sum+sum-mdis1-mdis3);
    }
    else
    {
        temp=max(mdis1+mdis4,mdis2+mdis3);
        cout<< setprecision(20)<<(sum+sum-temp)/10;
        //printf("%Lf\n",sum+sum-temp);
    }
    return 0;
}


#include <cstdlib>
#include <iostream>
#include <string.h>
#include <iomanip>
#include <fstream>
#include <vector>
#include <math.h>
#include <climits>
#include <stdio.h>
using namespace std;

int main()
{
    long long ax,ay,bx,by,tx,ty,x,y,m1,m2,m3,m4;
    long double mdis1=0,mdis2=0,sum,temp1,temp2,mdis3=0,mdis4=0,sum2,temp;
    int n;
    sum=0;
    cin>>ax>>ay>>bx>>by>>tx>>ty;
    ax=ax*100;
    ay=ay*100;
    bx=bx*100;
    by=by*100;
    tx=tx*100;
    ty=ty*100;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>y;
        x=x*100;
        y=y*100;
        temp1=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y))-sqrtl((ax-x)*(ax-x)+(ay-y)*(ay-y));
        temp2=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y))-sqrtl((bx-x)*(bx-x)+(by-y)*(by-y));
        if(temp1>mdis1)
        {
            mdis2=mdis1;
            mdis1=temp1;
            m2=m1;
            m1=i;
        }
        else if(temp1>mdis2)
        {
            mdis2=temp1;
            m2=i;
        }
        if(temp2>mdis3)
        {
            mdis4=mdis3;
            mdis3=temp2;
            m3=i;
        }
        else if(temp2>mdis4)
        {
            mdis4=temp2;
            m4=i;
        }
        sum+=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y));
    }
   // cout<<sum+sum-mdis1-mdis3;
    if(m1!=m3)
    {
        cout<< setprecision(20)<<(sum+sum-mdis1-mdis3)/100;
        //printf("%Lf\n",sum+sum-mdis1-mdis3);
    }
    else
    {
        temp=max(mdis1+mdis4,mdis2+mdis3);
        cout<< setprecision(20)<<(sum+sum-temp)/100;
        //printf("%Lf\n",sum+sum-temp);
    }
    return 0;
}


#include <cstdlib>
#include <iostream>
#include <string.h>
#include <iomanip>
#include <fstream>
#include <vector>
#include <math.h>
#include <climits>
#include <stdio.h>
using namespace std;

int main()
{
    long long ax,ay,bx,by,tx,ty,x,y,m1,m2,m3,m4;
    long double mdis1=0,mdis2=0,sum,temp1,temp2,mdis3=0,mdis4=0,sum2,temp;
    int n;
    sum=0;
    cin>>ax>>ay>>bx>>by>>tx>>ty;
    ax=ax*10;
    ay=ay*10;
    bx=bx*10;
    by=by*10;
    tx=tx*10;
    ty=ty*10;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>y;
        x=x*10;
        y=y*10;
        temp1=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y))-sqrtl((ax-x)*(ax-x)+(ay-y)*(ay-y));
        temp2=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y))-sqrtl((bx-x)*(bx-x)+(by-y)*(by-y));
        if(temp1>mdis1)
        {
            mdis2=mdis1;
            mdis1=temp1;
            m2=m1;
            m1=i;
        }
        else if(temp1>mdis2)
        {
            mdis2=temp1;
            m2=i;
        }
        if(temp2>mdis3)
        {
            mdis4=mdis3;
            mdis3=temp2;
            m3=i;
        }
        else if(temp2>mdis4)
        {
            mdis4=temp2;
            m4=i;
        }
        sum+=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y));
    }
   // cout<<sum+sum-mdis1-mdis3;
    if(m1!=m3)
    {
        cout<< setprecision(20)<<(sum+sum-mdis1-mdis3)/10;
        //printf("%Lf\n",sum+sum-mdis1-mdis3);
    }
    else
    {
        temp=max(mdis1+mdis4,mdis2+mdis3);
        cout<< setprecision(20)<<(sum+sum-temp)/10;
        //printf("%Lf\n",sum+sum-temp);
    }
    return 0;
}


#include <cstdlib>
#include <iostream>
#include <string.h>
#include <iomanip>
#include <fstream>
#include <vector>
#include <math.h>
#include <climits>
#include <stdio.h>
using namespace std;

int main()
{
    unsigned int ax,ay,bx,by,tx,ty,x,y,m1,m2,m3,m4;
    long double mdis1=0,mdis2=0,sum,temp1,temp2,mdis3=0,mdis4=0,sum2,temp;
    int n;
    sum=0;
    cin>>ax>>ay>>bx>>by>>tx>>ty;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>y;
        temp1=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y))-sqrtl((ax-x)*(ax-x)+(ay-y)*(ay-y));
        temp2=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y))-sqrtl((bx-x)*(bx-x)+(by-y)*(by-y));
        if(temp1>mdis1)
        {
            mdis2=mdis1;
            mdis1=temp1;
            m2=m1;
            m1=i;
        }
        else if(temp1>mdis2)
        {
            mdis2=temp1;
            m2=i;
        }
        if(temp2>mdis3)
        {
            mdis4=mdis3;
            mdis3=temp2;
            m3=i;
        }
        else if(temp2>mdis4)
        {
            mdis4=temp2;
            m4=i;
        }
        sum+=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y));
    }
   // cout<<sum+sum-mdis1-mdis3;
    if(m1!=m3)
    {
        cout<< setprecision(20)<<sum+sum-mdis1-mdis3;
        //printf("%Lf\n",sum+sum-mdis1-mdis3);
    }
    else
    {
        temp=max(mdis1+mdis4,mdis2+mdis3);
        cout<< setprecision(20)<<sum+sum-temp;
        //printf("%Lf\n",sum+sum-temp);
    }
    return 0;
}


#include <cstdlib>
#include <iostream>
#include <string.h>
#include <iomanip>
#include <fstream>
#include <vector>
#include <math.h>
#include <climits>
#include <stdio.h>
using namespace std;

int main()
{
    long long ax,ay,bx,by,tx,ty,x,y,m1,m2,m3,m4;
    long double mdis1=0,mdis2=-10000000000,sum,temp1,temp2,mdis3=0,mdis4=-10000000000,sum2,temp;
    int n;
    sum=0;
    m1=m2=m3=m4=-1;
    cin>>ax>>ay>>bx>>by>>tx>>ty;
    ax=ax;
    ay=ay;
    bx=bx;
    by=by;
    tx=tx;
    ty=ty;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>y;
        x=x;
        y=y;
        temp1=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y))-sqrtl((ax-x)*(ax-x)+(ay-y)*(ay-y));
        temp2=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y))-sqrtl((bx-x)*(bx-x)+(by-y)*(by-y));
        if(temp1>mdis1)
        {
            mdis2=mdis1;
            mdis1=temp1;
            m2=m1;
            m1=i;
        }
        else if(temp1>mdis2)
        {
            mdis2=temp1;
            m2=i;
        }
        if(temp2>mdis3)
        {
            mdis4=mdis3;
            mdis3=temp2;
            m3=i;
        }
        else if(temp2>mdis4)
        {
            mdis4=temp2;
            m4=i;
        }
        sum+=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y));
    }
   // cout<<sum+sum-mdis1-mdis3;
    if(m1!=m3)
    {
        cout<< setprecision(20)<<(sum+sum-mdis1-mdis3);
        //printf("%Lf\n",sum+sum-mdis1-mdis3);
    }
    else
    {
        /*cout<< setprecision(20)<<mdis1<<endl;
        cout<< setprecision(20)<<mdis2<<endl;
        cout<< setprecision(20)<<mdis3<<endl;
        cout<< setprecision(20)<<mdis4<<endl;*/
        temp=max(mdis1+mdis4,mdis2+mdis3);
        cout<< setprecision(20)<<(sum+sum-temp);
        //printf("%Lf\n",sum+sum-temp);
    }
    return 0;
}


#include <cstdlib>
#include <iostream>
#include <string.h>
#include <iomanip>
#include <fstream>
#include <vector>
#include <math.h>
#include <climits>
#include <stdio.h>
using namespace std;

int main()
{
    long long ax,ay,bx,by,tx,ty,x,y,m1,m2,m3,m4;
    long double mdis1=0,mdis2=0,sum,temp1,temp2,mdis3=0,mdis4=0,sum2,temp;
    int n;
    sum=0;
    m1=m2=m3=m4=-1;
    cin>>ax>>ay>>bx>>by>>tx>>ty;
    ax=ax;
    ay=ay;
    bx=bx;
    by=by;
    tx=tx;
    ty=ty;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>y;
        x=x;
        y=y;
        temp1=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y))-sqrtl((ax-x)*(ax-x)+(ay-y)*(ay-y));
        temp2=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y))-sqrtl((bx-x)*(bx-x)+(by-y)*(by-y));
        if(temp1>mdis1)
        {
            mdis2=mdis1;
            mdis1=temp1;
            m2=m1;
            m1=i;
        }
        else if(temp1>mdis2)
        {
            mdis2=temp1;
            m2=i;
        }
        if(temp2>mdis3)
        {
            mdis4=mdis3;
            mdis3=temp2;
            m3=i;
        }
        else if(temp2>mdis4)
        {
            mdis4=temp2;
            m4=i;
        }
        sum+=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y));
    }
   // cout<<sum+sum-mdis1-mdis3;
    if(m1!=m3)
    {
        cout<< setprecision(20)<<(sum+sum-mdis1-mdis3);
        //printf("%Lf\n",sum+sum-mdis1-mdis3);
    }
    else
    {
        temp=max(mdis1+mdis4,mdis2+mdis3);
        cout<< setprecision(20)<<(sum+sum-temp);
        //printf("%Lf\n",sum+sum-temp);
    }
    return 0;
}


#include <cstdlib>
#include <iostream>
#include <string.h>
#include <iomanip>
#include <fstream>
#include <vector>
#include <math.h>
#include <climits>
#include <stdio.h>
using namespace std;

int main()
{
    long long ax,ay,bx,by,tx,ty,x,y,m1,m2,m3,m4;
    double mdis1=0,mdis2=0,sum,temp1,temp2,mdis3=0,mdis4=0,sum2,temp;
    int n;
    sum=0;
    m1=m2=m3=m4=-1;
    cin>>ax>>ay>>bx>>by>>tx>>ty;
    ax=ax*10;
    ay=ay*10;
    bx=bx*10;
    by=by*10;
    tx=tx*10;
    ty=ty*10;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>y;
        x=x*10;
        y=y*10;
        temp1=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y))-sqrtl((ax-x)*(ax-x)+(ay-y)*(ay-y));
        temp2=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y))-sqrtl((bx-x)*(bx-x)+(by-y)*(by-y));
        if(temp1>mdis1)
        {
            mdis2=mdis1;
            mdis1=temp1;
            m2=m1;
            m1=i;
        }
        else if(temp1>mdis2)
        {
            mdis2=temp1;
            m2=i;
        }
        if(temp2>mdis3)
        {
            mdis4=mdis3;
            mdis3=temp2;
            m3=i;
        }
        else if(temp2>mdis4)
        {
            mdis4=temp2;
            m4=i;
        }
        sum+=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y));
    }
   // cout<<sum+sum-mdis1-mdis3;
    if(m1!=m3)
    {
        cout<< setprecision(20)<<(sum+sum-mdis1-mdis3)/10;
        //printf("%Lf\n",sum+sum-mdis1-mdis3);
    }
    else
    {
        temp=max(mdis1+mdis4,mdis2+mdis3);
        cout<< setprecision(20)<<(sum+sum-temp)/10;
        //printf("%Lf\n",sum+sum-temp);
    }
    return 0;
}


#include <cstdlib>
#include <iostream>
#include <string.h>
#include <iomanip>
#include <fstream>
#include <vector>
#include <math.h>
#include <climits>
#include <stdio.h>
using namespace std;

int main()
{
    long long ax,ay,bx,by,tx,ty,x,y,m1,m2,m3,m4;
    double mdis1=0,mdis2=0,sum,temp1,temp2,mdis3=0,mdis4=0,sum2,temp;
    int n;
    sum=0;
    m1=m2=m3=m4=-1;
    cin>>ax>>ay>>bx>>by>>tx>>ty;
    ax=ax;
    ay=ay;
    bx=bx;
    by=by;
    tx=tx;
    ty=ty;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>y;
        x=x;
        y=y;
        temp1=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y))-sqrtl((ax-x)*(ax-x)+(ay-y)*(ay-y));
        temp2=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y))-sqrtl((bx-x)*(bx-x)+(by-y)*(by-y));
        if(temp1>mdis1)
        {
            mdis2=mdis1;
            mdis1=temp1;
            m2=m1;
            m1=i;
        }
        else if(temp1>mdis2)
        {
            mdis2=temp1;
            m2=i;
        }
        if(temp2>mdis3)
        {
            mdis4=mdis3;
            mdis3=temp2;
            m3=i;
        }
        else if(temp2>mdis4)
        {
            mdis4=temp2;
            m4=i;
        }
        sum+=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y));
    }
   // cout<<sum+sum-mdis1-mdis3;
    if(m1!=m3)
    {
        cout<< setprecision(20)<<(sum+sum-mdis1-mdis3);
        //printf("%Lf\n",sum+sum-mdis1-mdis3);
    }
    else
    {
        temp=max(mdis1+mdis4,mdis2+mdis3);
        cout<< setprecision(20)<<(sum+sum-temp);
        //printf("%Lf\n",sum+sum-temp);
    }
    return 0;
}


#include <cstdlib>
#include <iostream>
#include <string.h>
#include <iomanip>
#include <fstream>
#include <vector>
#include <math.h>
#include <climits>
#include <stdio.h>
using namespace std;

int main()
{
    long long ax,ay,bx,by,tx,ty,x,y,m1,m2,m3,m4;
    long double mdis1=0,mdis2=0,sum,temp1,temp2,mdis3=0,mdis4=0,sum2,temp;
    int n;
    sum=0;
    cin>>ax>>ay>>bx>>by>>tx>>ty;
    ax=ax*1000;
    ay=ay*1000;
    bx=bx*1000;
    by=by*1000;
    tx=tx*1000;
    ty=ty*1000;
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>x>>y;
        x=x*1000;
        y=y*1000;
        temp1=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y))-sqrtl((ax-x)*(ax-x)+(ay-y)*(ay-y));
        temp2=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y))-sqrtl((bx-x)*(bx-x)+(by-y)*(by-y));
        if(temp1>mdis1)
        {
            mdis2=mdis1;
            mdis1=temp1;
            m2=m1;
            m1=i;
        }
        else if(temp1>mdis2)
        {
            mdis2=temp1;
            m2=i;
        }
        if(temp2>mdis3)
        {
            mdis4=mdis3;
            mdis3=temp2;
            m3=i;
        }
        else if(temp2>mdis4)
        {
            mdis4=temp2;
            m4=i;
        }
        sum+=sqrtl((tx-x)*(tx-x)+(ty-y)*(ty-y));
    }
   // cout<<sum+sum-mdis1-mdis3;
    if(m1!=m3)
    {
        cout<< setprecision(20)<<(sum+sum-mdis1-mdis3)/1000;
        //printf("%Lf\n",sum+sum-mdis1-mdis3);
    }
    else
    {
        temp=max(mdis1+mdis4,mdis2+mdis3);
        cout<< setprecision(20)<<(sum+sum-temp)/1000;
        //printf("%Lf\n",sum+sum-temp);
    }
    return 0;
}


#include <stdio.h>
#include <iomanip>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <math.h>
#include <sstream>
using namespace std;
int main() {
    double ax, ay, bx, by, tx, ty;
    int n;
    double px[100005];
    double py[100005];
    double disa[100005];
    double disb[100005];
    double disx[100005];
    double mina, minb;
    while(cin>>ax>>ay>>bx>>by>>tx>>ty) {
        cin>>n;
        double ans = 0;

        for(int i = 0; i < n; ++i) {
            cin>>px[i]>>py[i];
            disx[i] = sqrt(pow(tx-px[i], 2)+pow(ty-py[i], 2));
            disa[i] = sqrt(pow(ax-px[i], 2)+pow(ay-py[i], 2));
            disb[i] = sqrt(pow(bx-px[i], 2)+pow(by-py[i], 2));
            ans += disx[i]+disx[i];
        }
        if(n == 1) {
            ans += min(disa[0], disb[0]) - disx[0];
            cout<<fixed<<setprecision(9)<<ans<<endl;
            continue;
        }
        double mina = INT_MAX;
        double minb = INT_MAX;
        int idxa[2] = {0}, idxb[2] = {0};
        for(int i = 0; i < n; ++i) {
            double t = disa[i] - disx[i];
            if(t < mina) {
                minb = mina;
                mina = t;
                idxa[1] = idxa[0];
                idxa[0] = i;
            } else if(t < minb) {
                minb = t;
                idxa[1] = i;
            }
        }
        mina = INT_MAX;
        minb = INT_MAX;
        for(int i = 0; i < n; ++i) {
            double t = disb[i] - disx[i];
            if(t < mina) {
                minb = mina;
                mina = t;
                idxb[1] = idxb[0];
                idxb[0] = i;
            } else if(t < minb) {
                minb = t;
                idxb[1] = i;
            }
        }
        double minnum = min(disa[idxa[0]] -disx[idxa[0]], disb[idxb[0]] -disx[idxb[0]]);
        if(idxa[0] != idxb[0])
            ans += min(minnum, disa[idxa[0]] -disx[idxa[0]]+ disb[idxb[0]] - disx[idxb[0]]);
        else {
            ans += min(minnum, min(disa[idxa[0]] -disx[idxa[0]]+ disb[idxb[1]] - disx[idxb[1]], disa[idxa[1]] -disx[idxa[1]]+ disb[idxb[0]] - disx[idxb[0]]));
        }
        cout<<fixed<<setprecision(9)<<ans<<endl;
    }
    return 0;

}


#include <stdio.h>
#include <iomanip>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <math.h>
#include <sstream>
using namespace std;
int main() {
    double ax, ay, bx, by, tx, ty;
    int n;
    double px[100005];
    double py[100005];
    double disa[100005];
    double disb[100005];
    double disx[100005];
    double mina, minb;
    while(cin>>ax>>ay>>bx>>by>>tx>>ty) {
        cin>>n;
        double ans = 0;

        for(int i = 0; i < n; ++i) {
            cin>>px[i]>>py[i];
            disx[i] = sqrt(pow(tx-px[i], 2)+pow(ty-py[i], 2));
            disa[i] = sqrt(pow(ax-px[i], 2)+pow(ay-py[i], 2));
            disb[i] = sqrt(pow(bx-px[i], 2)+pow(by-py[i], 2));
            ans += disx[i]+disx[i];
        }
        if(n == 1) {
            ans += min(disa[0], disb[0]) - disx[0];
            cout<<fixed<<setprecision(9)<<ans<<endl;
            continue;
        }
        double mina = disa[0];
        double minb = disa[0];
        int idxa[2] = {0}, idxb[2] = {0};
        for(int i = 0; i < n; ++i) {
            double t = disa[i] - disx[i];
            if(t <= mina) {
                minb = mina;
                mina = t;
                idxa[1] = idxa[0];
                idxa[0] = i;
            } else if(t < minb) {
                minb = t;
                idxa[1] = i;
            }
        }
        mina = disb[0];
        minb = disb[0];
        for(int i = 0; i < n; ++i) {
            double t = disb[i] - disx[i];
            if(t <= mina) {
                minb = mina;
                mina = t;
                idxb[1] = idxb[0];
                idxb[0] = i;
            } else if(t < minb) {
                minb = t;
                idxb[1] = i;
            }
        }
        if(idxa[0] != idxb[0])
            ans += disa[idxa[0]] -disx[idxa[0]]+ disb[idxb[0]] - disx[idxb[0]];
        else {
            ans += min(disa[idxa[0]] -disx[idxa[0]]+ disb[idxb[1]] - disx[idxb[1]], disa[idxa[1]] -disx[idxa[1]]+ disb[idxb[0]] - disx[idxb[0]]);
        }
        cout<<fixed<<setprecision(9)<<ans<<endl;
    }
    return 0;

}


#include <stdio.h>
#include <iomanip>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <math.h>
#include <sstream>
using namespace std;

int main() {
    double ax, ay, bx, by, tx, ty;
    int n;
    double px[100005];
    double py[100005];
    double disa[100005];
    double disb[100005];
    double disx[100005];
    double mina, minb;
    while(cin>>ax>>ay>>bx>>by>>tx>>ty) {
        cin>>n;
        double ans = 0;

        for(int i = 0; i < n; ++i) {
            cin>>px[i]>>py[i];
            disx[i] = sqrt(pow(tx-px[i], 2)+pow(ty-py[i], 2));
            disa[i] = sqrt(pow(ax-px[i], 2)+pow(ay-py[i], 2));
            disb[i] = sqrt(pow(bx-px[i], 2)+pow(by-py[i], 2));
            ans += disx[i]+disx[i];
        }
        double mina = ans;
        double minb = ans;
        int idxa[2], idxb[2];
        for(int i = 0; i < n; ++i) {
            int t = disa[i] - disx[i];
            if(t < mina) {
                minb = mina;
                mina = t;
                idxa[1] = idxa[0];
                idxa[0] = i;
            } else if(t < minb) {
                minb = t;
                idxa[1] = i;
            }
        }
        mina = ans;
        minb = ans;
        for(int i = 0; i < n; ++i) {
            int t = disa[i] - disx[i];
            if(t < mina) {
                minb = mina;
                mina = t;
                idxb[1] = idxb[0];
                idxb[0] = i;
            } else if(t < minb) {
                minb = t;
                idxb[1] = i;
            }
        }
        if(idxa[0] != idxb[0])
            ans += disa[idxa[0]] -disx[idxa[0]]+ disb[idxb[0]] - disx[idxb[0]];
        else {
            ans += min(disa[idxa[0]] -disx[idxa[0]]+ disb[idxb[1]] - disx[idxb[1]], disa[idxa[1]] -disx[idxa[1]]+ disb[idxb[0]] - disx[idxb[0]]);
        }
        cout<<fixed<<setprecision(9)<<ans<<endl;
    }
    return 0;

}


#include <stdio.h>
#include <iomanip>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <math.h>
#include <sstream>
using namespace std;

int main() {
    double ax, ay, bx, by, tx, ty;
    int n;
    double px[100005];
    double py[100005];
    double disa[100005];
    double disb[100005];
    double disx[100005];
    double mina, minb;
    while(cin>>ax>>ay>>bx>>by>>tx>>ty) {
        cin>>n;
        double ans = 0;

        for(int i = 0; i < n; ++i) {
            cin>>px[i]>>py[i];
            disx[i] = sqrt(pow(tx-px[i], 2)+pow(ty-py[i], 2));
            disa[i] = sqrt(pow(ax-px[i], 2)+pow(ay-py[i], 2));
            disb[i] = sqrt(pow(bx-px[i], 2)+pow(by-py[i], 2));
            ans += disx[i]+disx[i];
        }
        if(n == 1) {
            ans += min(disa[0], disb[0]) - disx[0];
            cout<<fixed<<setprecision(9)<<ans<<endl;
            continue;
        }
        double mina = disa[0];
        double minb = disa[0];
        int idxa[2], idxb[2];
        for(int i = 0; i < n; ++i) {
            int t = disa[i] - disx[i];
            if(t < mina) {
                minb = mina;
                mina = t;
                idxa[1] = idxa[0];
                idxa[0] = i;
            } else if(t < minb) {
                minb = t;
                idxa[1] = i;
            }
        }
        mina = disb[0];
        minb = disb[0];
        for(int i = 0; i < n; ++i) {
            int t = disb[i] - disx[i];
            if(t < mina) {
                minb = mina;
                mina = t;
                idxb[1] = idxb[0];
                idxb[0] = i;
            } else if(t < minb) {
                minb = t;
                idxb[1] = i;
            }
        }
        if(idxa[0] != idxb[0])
            ans += disa[idxa[0]] -disx[idxa[0]]+ disb[idxb[0]] - disx[idxb[0]];
        else {
            ans += min(disa[idxa[0]] -disx[idxa[0]]+ disb[idxb[1]] - disx[idxb[1]], disa[idxa[1]] -disx[idxa[1]]+ disb[idxb[0]] - disx[idxb[0]]);
        }
        cout<<fixed<<setprecision(9)<<ans<<endl;
    }
    return 0;

}


#include <stdio.h>
#include <iomanip>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <math.h>
#include <sstream>
using namespace std;
int main() {
    double ax, ay, bx, by, tx, ty;
    int n;
    double px[100005];
    double py[100005];
    double disa[100005];
    double disb[100005];
    double disx[100005];
    double mina, minb;
    while(cin>>ax>>ay>>bx>>by>>tx>>ty) {
        cin>>n;
        double ans = 0;

        for(int i = 0; i < n; ++i) {
            cin>>px[i]>>py[i];
            disx[i] = sqrt(pow(tx-px[i], 2)+pow(ty-py[i], 2));
            disa[i] = sqrt(pow(ax-px[i], 2)+pow(ay-py[i], 2));
            disb[i] = sqrt(pow(bx-px[i], 2)+pow(by-py[i], 2));
            ans += disx[i]+disx[i];
        }
        if(n == 1) {
            ans += min(disa[0], disb[0]) - disx[0];
            cout<<fixed<<setprecision(9)<<ans<<endl;
            continue;
        }
        double mina = INT_MAX;
        double minb = INT_MAX;
        int idxa[2] = {0}, idxb[2] = {0};
        for(int i = 0; i < n; ++i) {
            double t = disa[i] - disx[i];
            if(t < mina) {
                minb = mina;
                mina = t;
                idxa[1] = idxa[0];
                idxa[0] = i;
            } else if(t < minb) {
                minb = t;
                idxa[1] = i;
            }
        }
        mina = INT_MAX;
        minb = INT_MAX;
        for(int i = 0; i < n; ++i) {
            double t = disb[i] - disx[i];
            if(t < mina) {
                minb = mina;
                mina = t;
                idxb[1] = idxb[0];
                idxb[0] = i;
            } else if(t < minb) {
                minb = t;
                idxb[1] = i;
            }
        }
        if(idxa[0] != idxb[0])
            ans += disa[idxa[0]] -disx[idxa[0]]+ disb[idxb[0]] - disx[idxb[0]];
        else {
            ans += min(disa[idxa[0]] -disx[idxa[0]]+ disb[idxb[1]] - disx[idxb[1]], disa[idxa[1]] -disx[idxa[1]]+ disb[idxb[0]] - disx[idxb[0]]);
        }
        cout<<fixed<<setprecision(9)<<ans<<endl;
    }
    return 0;

}


#include <stdio.h>
#include <iomanip>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <math.h>
#include <sstream>
using namespace std;

int main() {
    double ax, ay, bx, by, tx, ty;
    int n;
    double px[100005];
    double py[100005];
    double disa[100005];
    double disb[100005];
    double disx[100005];
    double mina, minb;
    while(cin>>ax>>ay>>bx>>by>>tx>>ty) {
        cin>>n;
        double ans = 0;

        for(int i = 0; i < n; ++i) {
            cin>>px[i]>>py[i];
            disx[i] = sqrt(pow(tx-px[i], 2)+pow(ty-py[i], 2));
            disa[i] = sqrt(pow(ax-px[i], 2)+pow(ay-py[i], 2));
            disb[i] = sqrt(pow(bx-px[i], 2)+pow(by-py[i], 2));
            ans += disx[i]+disx[i];
        }
        if(n == 1) {
            ans += min(disa[0], disb[0]) - disx[0];
            cout<<fixed<<setprecision(9)<<ans<<endl;
            continue;
        }
        double mina = ans;
        double minb = ans;
        int idxa[2], idxb[2];
        for(int i = 0; i < n; ++i) {
            int t = disa[i] - disx[i];
            if(t < mina) {
                minb = mina;
                mina = t;
                idxa[1] = idxa[0];
                idxa[0] = i;
            } else if(t < minb) {
                minb = t;
                idxa[1] = i;
            }
        }
        mina = ans;
        minb = ans;
        for(int i = 0; i < n; ++i) {
            int t = disa[i] - disx[i];
            if(t < mina) {
                minb = mina;
                mina = t;
                idxb[1] = idxb[0];
                idxb[0] = i;
            } else if(t < minb) {
                minb = t;
                idxb[1] = i;
            }
        }
        if(idxa[0] != idxb[0])
            ans += disa[idxa[0]] -disx[idxa[0]]+ disb[idxb[0]] - disx[idxb[0]];
        else {
            ans += min(disa[idxa[0]] -disx[idxa[0]]+ disb[idxb[1]] - disx[idxb[1]], disa[idxa[1]] -disx[idxa[1]]+ disb[idxb[0]] - disx[idxb[0]]);
        }
        cout<<fixed<<setprecision(9)<<ans<<endl;
    }
    return 0;

}


#include <stdio.h>
#include <iomanip>
#include <iostream>
#include <string.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <math.h>
#include <sstream>
using namespace std;

int main() {
    double ax, ay, bx, by, tx, ty;
    int n;
    double px[100005];
    double py[100005];
    double disa[100005];
    double disb[100005];
    double disx[100005];
    double mina, minb;
    while(cin>>ax>>ay>>bx>>by>>tx>>ty) {
        cin>>n;
        double ans = 0;

        for(int i = 0; i < n; ++i) {
            cin>>px[i]>>py[i];
            disx[i] = sqrt(pow(tx-px[i], 2)+pow(ty-py[i], 2));
            disa[i] = sqrt(pow(ax-px[i], 2)+pow(ay-py[i], 2));
            disb[i] = sqrt(pow(bx-px[i], 2)+pow(by-py[i], 2));
            ans += disx[i]+disx[i];
        }
        double mina = ans;
        double minb = ans;
        int idxa[2], idxb[2];
        for(int i = 0; i < n; ++i) {
            int t = disa[i] - disx[i];
            if(t < mina) {
                minb = mina;
                mina = t;
                idxa[1] = idxa[0];
                idxa[0] = i;
            } else if(t < minb) {
                minb = t;
                idxa[1] = i;
            }
        }
        mina = ans;
        minb = ans;
        for(int i = 0; i < n; ++i) {
            int t = disa[i] - disx[i];
            if(t < mina) {
                minb = mina;
                mina = t;
                idxb[1] = idxb[0];
                idxb[0] = i;
            } else if(t < minb) {
                minb = t;
                idxb[1] = i;
            }
        }
        if(idxa[0] != idxb[0])
            ans += disa[idxa[0]] -disx[idxa[0]]+ disb[idxb[0]] - disx[idxb[0]];
        else {
            ans += min(disa[idxa[0]] -disx[idxa[0]]+ disb[idxb[1]] - disx[idxb[1]], disa[idxa[1]] -disx[idxa[1]]+ disb[idxb[0]] - disx[idxb[0]]);
        }
        cout<<ans<<endl;
    }
    return 0;

}