#include <bits/stdc++.h>
using namespace std;
double a[100010];
double b[100010];
double t[100010];
int main() {
  long long ax, ay, bx, by, tx, ty;
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  int n;
  cin >> n;
  long long x, y;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    a[i] = sqrt((double)((x - ax) * (x - ax) + (y - ay) * (y - ay)));
    b[i] = sqrt((double)((x - bx) * (x - bx) + (y - by) * (y - by)));
    t[i] = sqrt((double)((x - tx) * (x - tx) + (y - ty) * (y - ty)));
  }
  double sum = 0;
  for (int i = 0; i < n; i++) sum += 2 * t[i];
  if (n == 1) {
    sum = min(a[0], b[0]) + t[0];
    printf("%.10lf", sum);
    return 0;
  }
  int ai = 0, bi = 0;
  int ai2 = -1;
  int bi2 = -1;
  int aii, bii;
  for (int i = 0; i < n; i++) {
    if (t[i] - a[i] > t[ai] - a[ai]) ai = i;
    if (t[i] - b[i] > t[bi] - b[bi]) bi = i;
  }
  aii = ai;
  bii = bi;
  if (t[aii] < a[aii] || t[bii] < b[bii]) {
    sum -= max(t[aii] - a[aii], t[bii] - b[bii]);
    printf("%.10lf", sum);
    return 0;
  }
  if (ai == bi) {
    for (int i = 0; i < n; i++) {
      if ((ai2 == -1 || t[i] - a[i] > t[ai2] - a[ai2]) && i != ai) ai2 = i;
      if ((bi2 == -1 || t[i] - b[i] > t[bi2] - b[bi2]) && i != bi) bi2 = i;
    }
    if (t[ai] - a[ai] + max(0.0, t[bi2] - b[bi2]) >
        max(0.0, t[ai2] - a[ai2]) + t[bi] - b[bi])
      bii = bi2;
    else
      aii = ai2;
  }
  if (t[aii] < a[aii] || t[bii] < b[bii]) {
    sum -= max(t[aii] - a[aii], t[bii] - b[bii]);
    printf("%.10lf", sum);
    return 0;
  }
  sum -= t[aii] + t[bii];
  sum += a[aii] + b[bii];
  printf("%.10lf", sum);
  return 0;
}
