#include <bits/stdc++.h>
using namespace std;
int main() {
  long long Ax, Ay, Bx, By, Tx, Ty, x, y, N;
  double tmp, tmp1, T, ans = 0;
  cin >> Ax >> Ay >> Bx >> By >> Tx >> Ty >> N;
  double X[N], Y[N];
  pair<double, long long> A[N], B[N];
  for (long long i = 0; i < N; i++) {
    cin >> x >> y;
    X[i] = x;
    Y[i] = y;
    tmp = abs(Tx - x);
    tmp1 = abs(Ty - y);
    T = (double)sqrt(tmp * tmp + tmp1 * tmp1);
    ans += T + T;
    tmp = abs(Ax - x);
    tmp1 = abs(Ay - y);
    A[i].first = (double)sqrt(tmp * tmp + tmp1 * tmp1) - T;
    tmp = abs(Bx - x);
    tmp1 = abs(By - y);
    B[i].first = (double)sqrt(tmp * tmp + tmp1 * tmp1) - T;
    A[i].second = i;
    B[i].second = i;
  }
  sort(A, A + N);
  sort(B, B + N);
  if (A[0].second != B[0].second) {
    tmp = 0;
    if (A[0].first < 0 && B[0].first < 0) {
      tmp += A[0].first;
      tmp += B[0].first;
    } else {
      if (A[0].first <= B[0].first) {
        tmp += A[0].first;
      } else {
        tmp += B[0].first;
      }
    }
    cout << fixed << setprecision(7) << ans + tmp << endl;
  } else if (N == 1) {
    if (A[0].first <= B[0].first) {
      cout << fixed << setprecision(7) << ans + A[0].first << endl;
    } else {
      cout << fixed << setprecision(7) << ans + B[0].first << endl;
    }
  } else {
    tmp = 0;
    if (A[1].first < 0 && B[0].first < 0) {
      tmp += A[1].first;
      tmp += B[0].first;
    } else {
      if (A[1].first <= B[0].first) {
        tmp += A[1].first;
      } else {
        tmp += B[0].first;
      }
    }
    tmp1 = 0;
    if (A[0].first < 0 && B[1].first < 0) {
      tmp1 += A[0].first;
      tmp1 += B[1].first;
    } else {
      if (A[0].first <= B[1].first) {
        tmp1 += A[0].first;
      } else {
        tmp1 += B[1].first;
      }
    }
    if (tmp <= tmp1) {
      cout << fixed << setprecision(7) << ans + tmp << endl;
    } else {
      cout << fixed << setprecision(7) << ans + tmp1 << endl;
    }
  }
}
