#include <bits/stdc++.h>
using namespace std;
long double A[100001][2];
int main() {
  long double ax, ay, bx, by, tx, ty, x, y, a, b, c, d, X, Y;
  int i, n;
  int ind = -1, ind2 = -1, ind3 = -1, ind4 = -1;
  long double ans = 0.0, maxi[2], maxi2[2];
  maxi[0] = maxi[1] = 0;
  maxi2[0] = maxi2[1] = 0;
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  a = ax - tx;
  b = ay - ty;
  c = bx - tx;
  d = by - ty;
  a = a * 1.000000000;
  b = b * 1.000000000;
  c = c * 1.000000000;
  d = d * 1.000000000;
  cin >> n;
  ans += sqrt((a * a) + (b * b)) + sqrt((c * c) + (d * d));
  for (i = 0; i < n; i++) {
    cin >> x >> y;
    A[i][0] = x * 1.000000000;
    A[i][1] = y * 1.000000000;
    X = (x - ax) * 1.000000000;
    Y = (y - ay) * 1.000000000;
    a = (x - tx) * 1.000000000;
    b = (y - ty) * 1.000000000;
    c = (ax - tx) * 1.000000000;
    d = (ay - ty) * 1.000000000;
    if (sqrt((c * c) + (d * d)) + (sqrt((a * a) + (b * b))) -
            sqrt((X * X) + (Y * Y)) >
        maxi[0]) {
      maxi[1] = maxi[0];
      ind2 = ind;
      maxi[0] = sqrt((c * c) + (d * d)) + (sqrt((a * a) + (b * b))) -
                sqrt((X * X) + (Y * Y));
      ind = i;
    } else if (sqrt((c * c) + (d * d)) + (sqrt((a * a) + (b * b))) -
                   sqrt((X * X) + (Y * Y)) >
               maxi[1]) {
      maxi[1] = sqrt((c * c) + (d * d)) + (sqrt((a * a) + (b * b))) -
                sqrt((X * X) + (Y * Y));
      ind2 = i;
    }
    ans += (2.0 * 1.000000000 * sqrt((a * a) + (b * b)));
  }
  for (i = 0; i < n; i++) {
    x = A[i][0] * 1.000000000;
    y = A[i][1] * 1.000000000;
    X = (x - bx) * 1.000000000;
    Y = (y - by) * 1.000000000;
    a = (x - tx) * 1.000000000;
    b = (y - ty) * 1.000000000;
    c = (bx - tx) * 1.000000000;
    d = (by - ty) * 1.000000000;
    if (sqrt((c * c) + (d * d)) + (sqrt((a * a) + (b * b))) -
            sqrt((X * X) + (Y * Y)) >
        maxi2[0]) {
      maxi2[1] = maxi2[0];
      maxi2[0] = sqrt((c * c) + (d * d)) + (sqrt((a * a) + (b * b))) -
                 sqrt((X * X) + (Y * Y));
      ind4 = ind3;
      ind3 = i;
    } else if (sqrt((c * c) + (d * d)) + (sqrt((a * a) + (b * b))) -
                   sqrt((X * X) + (Y * Y)) >
               maxi2[1]) {
      maxi2[1] = sqrt((c * c) + (d * d)) + (sqrt((a * a) + (b * b))) -
                 sqrt((X * X) + (Y * Y));
      ind4 = i;
    }
  }
  a = ax - tx;
  b = ay - ty;
  c = bx - tx;
  d = by - ty;
  a = a * 1.000000000;
  b = b * 1.000000000;
  c = c * 1.000000000;
  d = d * 1.000000000;
  long double temp = min(ans - maxi[0] - sqrt((c * c) + (d * d)),
                         ans - maxi2[0] - sqrt((a * a) + (b * b)));
  if (ind == ind3) {
    ans = min(ans - maxi2[1] - maxi[0], ans - maxi2[0] - maxi[1]);
  } else {
    ans = ans - maxi2[0] - maxi[0];
  }
  ans = min(ans, temp);
  printf("%.12Lf", ans);
  return 0;
}
