#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
void Open() {}
const long double eps = 1e-10;
struct point {
  long long x, y;
  long double value;
  long double dist(long long cx, long long cy) {
    return sqrt(((cx - x) * (cx - x)) + ((cy - y) * (cy - y)));
  }
} p[100010];
struct info {
  long double d;
  long long id;
  bool operator<(const info &o) const { return d > o.d; }
} a[100010], b[100010];
long long ax, ay, bx, by, tx, ty, n;
int main() {
  scanf("%I64d%I64d%I64d%I64d%I64d%I64d%I64d", &ax, &ay, &bx, &by, &tx, &ty,
        &n);
  long double sum = 0;
  for (long long i = 0; i < n; i++) {
    scanf("%I64d%I64d", &p[i].x, &p[i].y);
    p[i].value = p[i].dist(tx, ty);
    sum += 2.0 * p[i].value;
  }
  for (long long i = 0; i < n; i++) {
    a[i] = (info){p[i].value - p[i].dist(ax, ay), i};
    b[i] = (info){p[i].value - p[i].dist(bx, by), i};
  }
  sort(a, a + n);
  sort(b, b + n);
  long double res = max(a[0].d, b[0].d);
  if (a[0].id != b[0].id) res = max(res, a[0].d + b[0].d);
  if (n > 1 && a[1].id != b[0].id) res = max(res, a[1].d + b[0].d);
  if (n > 1 && a[0].id != b[1].id) res = max(res, a[0].d + b[1].d);
  if (n > 1 && a[1].id != b[1].id) res = max(res, a[1].d + b[1].d);
  printf("%.12f\n", (double)(sum - res));
  return 0;
}
