#include <bits/stdc++.h>
using namespace std;
int x[100100], y[100100];
double d[100100];
pair<double, int> da[100100], db[100100];
double dist(long long x1, long long y1, long long x2, long long y2) {
  x1 -= x2;
  y1 -= y2;
  return sqrt(x1 * x1 + y1 * y1);
}
int main() {
  int ax, ay, bx, by, tx, ty;
  scanf("%d %d", &ax, &ay);
  scanf("%d %d", &bx, &by);
  scanf("%d %d", &tx, &ty);
  int n;
  scanf("%d", &n);
  double sum = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &x[i], &y[i]);
    d[i] = dist(tx, ty, x[i], y[i]);
    sum += 2 * d[i];
    da[i] = make_pair(dist(ax, ay, x[i], y[i]) - d[i], i);
    db[i] = make_pair(dist(bx, by, x[i], y[i]) - d[i], i);
  }
  sort(da, da + n);
  sort(db, db + n);
  double res = sum + da[0].first;
  res = min(res, db[0].first + sum);
  if (n > 1) {
    if (da[0].second == db[0].second) {
      res = min(res, sum + da[0].first + db[1].first);
      res = min(res, sum + da[1].first + db[0].first);
    } else {
      res = min(res, sum + da[0].first + db[0].first);
    }
  }
  printf("%.12lf\n", res);
  return 0;
}
