#include <bits/stdc++.h>   using namespace std;   int inf = 1000000005;   long long int llinf = 2000000000000000005LL;   long long int mod = 1000000007;   long long int mod9 = 1000000009;   double pi = 3.1415926535897;   double eps = 1e-15;   int dx[] = {1, -1, 0, 0, 1, -1, 1, -1}, dy[] = {0, 0, 1, -1, 1, 1, -1, -1};   vector<bool> isprime;   vector<int> primes;   void seive(int n, bool wantlist = true) {     isprime.resize(n + 1, true);     isprime[0] = isprime[1] = false;     int sq = sqrt(n + 1);     for (int i = 2; i < sq + 1; i++) {       if (isprime[i]) {         for (int j = i * i; j <= n; j += i) isprime[j] = false;       }     }     for (int i = 2; wantlist && i <= n; i++) {       if (isprime[i]) primes.push_back(i);     }   }   template <class T>   inline T gcd(T a, T b) {     while (b > 0) {       a %= b;       swap(a, b);     }     return a;   }   template <class T>   inline T lcm(T a, T b) {     return a * b / gcd(a, b);   }   template <class T>   inline vector<T> operator+(vector<T>& a, vector<T>& b) {     assert(a.size() == b.size());     int n = a.size();     vector<T> c(n);     for (int i = 0; i < n; i++) c[i] = a[i] + b[i];     return c;   }   int fastMax(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ y; }   inline long long int bexp(long long int x, long long int n,                             long long int m = mod) {     long long int res = 1;     x %= m;     while (n) {       if (n & 1) res = res * x % m;       x = x * x % m;       n >>= 1;     }     return res;   }   inline bool ispalin(string& str) {     int n = str.length();     for (int i = 0; i < n / 2; i++)       if (str[i] != str[n - i - 1]) return false;     return true;   }   inline void mapper(vector<int>& a, int idx = 0) {     int cc = idx, n = a.size();     map<int, vector<int> > mapp;     for (int i = 0; i < n; i++) mapp[a[i]].push_back(i);     for (auto& p : mapp) {       for (int i : p.second) a[i] = cc;       cc++;     }   }   template <class T>   inline void ri(T& i) {     char c;     for (c = getchar(); c <  0  || c >  9 ; c = getchar())       ;     for (i = 0; c >=  0  && c <=  9 ; c = getchar())       i = (i << 3) + (i << 1) + (c - 48);   }   long long int Euclid(long long int a, long long int b, long long int& x,                        long long int& y) {     if (b == 0LL) {       x = (a < 0LL ? -1LL : 1LL);       y = 0LL;       return a * x;     }     long long int q = a / b;     long long int r = a % b;     long long int d = Euclid(b, r, y, x);     y -= q * x;     return d;   }   long double calDistance(long long int x, long long int y) {     long double tx = (long double)(x);     long double ty = (long double)(y);     long double res = tx * tx + ty * ty;     res = sqrt(res);     return res;   }   int main() {     pair<long long int, long long int> a, b, t;     cin >> a.first >> a.second >> b.first >> b.second >> t.first >> t.second;     int n;     cin >> n;     vector<vector<long double> > dis(n, vector<long double>(3, 0.0));     for (int i = 0; i < n; i++) {       pair<long long int, long long int> bottle;       cin >> bottle.first >> bottle.second;       long long int x, y;       x = labs(bottle.first - t.first);       y = labs(bottle.second - t.second);       dis[i][0] = calDistance(x, y);       x = labs(bottle.first - a.first);       y = labs(bottle.second - a.second);       dis[i][1] = calDistance(x, y);       x = labs(bottle.first - b.first);       y = labs(bottle.second - b.second);       dis[i][2] = calDistance(x, y);     }     vector<vector<long double> > AL(n, vector<long double>(2, 0.0));     for (int i = 0; i < n; i++) {       if (!i) {         AL[i][0] = dis[i][0];         AL[i][1] = dis[i][1];       } else {         AL[i][0] = dis[i][0] + AL[i - 1][0];         AL[i][1] = min(AL[i - 1][0] + dis[i][1], AL[i - 1][1] + dis[i][0]);       }     }     vector<vector<long double> > AR(n, vector<long double>(2, 0.0));     for (int i = n - 1; i >= 0; i--) {       if (i == n - 1) {         AR[i][0] = dis[i][0];         AR[i][1] = dis[i][1];       } else {         AR[i][0] = dis[i][0] + AR[i + 1][0];         AR[i][1] = min(AR[i + 1][0] + dis[i][1], AR[i + 1][1] + dis[i][0]);       }     }     vector<vector<long double> > BL(n, vector<long double>(2, 0.0));     for (int i = 0; i < n; i++) {       if (!i) {         BL[i][0] = dis[i][0];         BL[i][1] = dis[i][2];       } else {         BL[i][0] = dis[i][0] + BL[i - 1][0];         BL[i][1] = min(BL[i - 1][0] + dis[i][2], BL[i - 1][1] + dis[i][0]);       }     }     vector<vector<long double> > BR(n, vector<long double>(2, 0.0));     for (int i = n - 1; i >= 0; i--) {       if (i == n - 1) {         BR[i][0] = dis[i][0];         BR[i][1] = dis[i][2];       } else {         BR[i][0] = dis[i][0] + BR[i + 1][0];         BR[i][1] = min(BR[i + 1][0] + dis[i][2], BR[i + 1][1] + dis[i][0]);       }     }     long double ans = min(AL[n - 1][1], BL[n - 1][1]);     for (int i = 0; i < n - 1; i++) {       long double val = min(AL[i][1] + BR[i + 1][1], BL[i][1] + AR[i + 1][1]);       ans = min(val, ans);     }     for (int i = 0; i < n; i++) {       ans += dis[i][0];     }     cout << fixed << setprecision(12) << ans <<   n ;     return 0;   }