#include <bits/stdc++.h>
using namespace std;
int n, x[100010], y[100010], ax, ay, bx, by, cx, cy, ma[2], mb[2];
double d[100010], da[100010], db[100010], ans, res = 2e18;
int main() {
  scanf("%d%d%d%d%d%d", &ax, &ay, &bx, &by, &cx, &cy);
  scanf("%d", &n);
  d[0] = 0;
  da[0] = db[0] = 1e18;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &x[i], &y[i]);
    d[i] =
        sqrt(1. * (x[i] - cx) * (x[i] - cx) + 1. * (y[i] - cy) * (y[i] - cy));
    da[i] =
        sqrt(1. * (x[i] - ax) * (x[i] - ax) + 1. * (y[i] - ay) * (y[i] - ay));
    db[i] =
        sqrt(1. * (x[i] - bx) * (x[i] - bx) + 1. * (y[i] - by) * (y[i] - by));
    ans += 2 * d[i];
    if (d[i] - da[i] > d[ma[0]] - da[ma[0]])
      ma[1] = ma[0], ma[0] = i;
    else if (d[i] - da[i] > d[ma[1]] - da[ma[1]])
      ma[1] = i;
    if (d[i] - db[i] > d[mb[0]] - db[mb[0]])
      mb[1] = mb[0], mb[0] = i;
    else if (d[i] - db[i] > d[mb[1]] - db[mb[1]])
      mb[1] = i;
  }
  for (int i = 0; i <= 1; i++)
    for (int j = 0; j <= 1; j++) {
      if (ma[i] != mb[j]) {
        res = min(res, ans - d[ma[i]] + da[ma[i]] - d[mb[j]] + db[mb[j]]);
      }
    }
  res = min(res, ans - d[ma[0]] + da[ma[0]]);
  res = min(res, ans - d[mb[0]] + db[mb[0]]);
  printf("%.12lf\n", res);
  return 0;
}
