#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-9;
const double inf = 1e15;
const int maxn = (int)1e5 + 5;
int n, m, besta, bestb;
double x[maxn], y[maxn], da[maxn], db[maxn], du[maxn], mina, minb, minna, minnb,
    sum, xa, ya, xb, yb, yu, xu;
double dist(double x1, double y, double x2, double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y - y2) * (y - y2));
}
int main() {
  cin >> xa >> ya >> xb >> yb >> xu >> yu;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
  for (int i = 0; i < n; i++) {
    da[i] = dist(xa, ya, x[i], y[i]);
    db[i] = dist(xb, yb, x[i], y[i]);
    du[i] = dist(xu, yu, x[i], y[i]);
    sum += 2 * du[i];
  }
  mina = minb = inf;
  for (int i = 0; i < n; i++) {
    if (da[i] - du[i] < mina) besta = i;
    mina = min(mina, da[i] - du[i]);
    if (db[i] - du[i] < minb) bestb = i;
    minb = min(minb, db[i] - du[i]);
  }
  if (mina > 0 || minb > 0) {
    printf("%.10lf", sum + min(mina, minb));
    return 0;
  }
  if (besta != bestb) {
    printf("%.10lf", sum + mina + minb);
    return 0;
  }
  minna = minnb = inf;
  for (int i = 0; i < n; i++) {
    if (i == besta) continue;
    minna = min(minna, da[i] - du[i]);
    minnb = min(minnb, db[i] - du[i]);
  }
  if (n == 1) {
    printf("%.10lf", min(sum + mina, sum + minb));
    return 0;
  }
  printf("%.10lf", min(min(sum + mina, sum + minb),
                       min(sum + mina + minnb, sum + minb + minna)));
  return 0;
}
