#include <bits/stdc++.h>
using namespace std;
bool deb = false;
int i;
const int N = 100011;
long long int da[N];
long long int db[N];
long long int dr[N];
pair<long long int, long long int> pt[N];
long long int dist(pair<long long int, long long int> a,
                   pair<long long int, long long int> b) {
  return ((a.first - b.first) * (a.first - b.first)) +
         ((a.second - b.second) * (a.second - b.second));
}
int main() {
  int i, j, n;
  long long int x1, x2, x3, y1, y2, y3;
  scanf("%lld", &x1), scanf("%lld", &y1);
  scanf("%lld", &x2), scanf("%lld", &y2);
  scanf("%lld", &x3), scanf("%lld", &y3);
  scanf("%d", &n);
  for (i = 0; i < n; ++i) {
    scanf("%lld", &pt[i].first), scanf("%lld", &pt[i].second);
    da[i] = dist(make_pair(x1, y1), pt[i]);
    db[i] = dist(make_pair(x2, y2), pt[i]);
    dr[i] = dist(make_pair(x3, y3), pt[i]);
  }
  long double tdt = 0, Tdt = 0;
  for (i = 0; i < n; ++i) {
    tdt += (long double)2 * sqrt(dr[i]);
  }
  Tdt = tdt;
  long long int na1 = -1;
  long long int nb1 = -1;
  long double mna = -2e18;
  long double mnb = 0;
  for (i = 0; i < n; ++i) {
    long double tmpa = sqrt(dr[i]);
    long double Tmpa = sqrt(da[i]);
    if ((tmpa - Tmpa) > mna) {
      mna = (tmpa - Tmpa);
      na1 = i;
    }
  }
  tdt = tdt - (long double)sqrt(dr[na1]) + (long double)sqrt(da[na1]);
  for (i = 0; i < n; ++i) {
    if (i == na1) continue;
    long double tmpb = sqrt(dr[i]);
    long double Tmpb = sqrt(db[i]);
    if ((tmpb - Tmpb) > mnb) {
      mnb = (tmpb - Tmpb);
      nb1 = i;
    }
  }
  if (nb1 != -1) {
    tdt = tdt - (long double)sqrt(dr[nb1]) + (long double)sqrt(db[nb1]);
  }
  na1 = -1;
  nb1 = -1;
  mna = -2e18;
  mnb = 0;
  for (i = 0; i < n; ++i) {
    long double tmpa = sqrt(dr[i]);
    long double Tmpa = sqrt(db[i]);
    if ((tmpa - Tmpa) > mna) {
      mna = (tmpa - Tmpa);
      na1 = i;
    }
  }
  Tdt = Tdt - (long double)sqrt(dr[na1]) + (long double)sqrt(db[na1]);
  for (i = 0; i < n; ++i) {
    if (i == na1) continue;
    long double tmpb = sqrt(dr[i]);
    long double Tmpb = sqrt(da[i]);
    if ((tmpb - Tmpb) > mnb) {
      mnb = (tmpb - Tmpb);
      nb1 = i;
    }
  }
  if (nb1 != -1) {
    Tdt = Tdt - (long double)sqrt(dr[nb1]) + (long double)sqrt(da[nb1]);
  }
  long double ans;
  if ((tdt - Tdt) < 2e-18)
    ans = tdt;
  else
    ans = Tdt;
  cout << fixed;
  cout.precision(12);
  cout << ans << "\n";
  return 0;
}
