#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 100010;
double sum, m, distan1[MAXN], distan2[MAXN], s1[MAXN], s2[MAXN];
int n, a1, a2, b1, b2, satl1, satl2, x[MAXN], y[MAXN];
long long gh(long long a) {
  if (a < 0) return -a;
  return a;
}
long long poww(long long a, long long b) {
  long long sum = 1;
  for (int i = 0; i < b; i++) sum *= a;
  return sum;
}
double dis(int a, int b, int c, int d) {
  long long x = gh(a - c);
  long long y = gh(b - d);
  return sqrt(poww(x, 2) + poww(y, 2));
}
int main() {
  cin >> a1 >> a2 >> b1 >> b2 >> satl1 >> satl2 >> n;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    m = dis(satl1, satl2, x[i], y[i]);
    sum += 2 * m;
    double q1 = dis(a1, a2, x[i], y[i]);
    double q2 = dis(b1, b2, x[i], y[i]);
    s1[i] = q1;
    s2[i] = q2;
    distan1[i] = q1 - m;
    distan2[i] = q2 - m;
  }
  if (n == 1) {
    cout << setprecision(12) << sum + min(distan1[0], distan2[0]);
    return 0;
  }
  double l11 = 1e18, l12 = 1e18, l21 = 1e18, l22 = 1e18;
  int u1 = -1, u2 = -1, u3 = -1, u4 = -1;
  for (int i = 0; i < n; i++) {
    if (distan1[i] < l11) l11 = distan1[i], u1 = i;
    if (distan2[i] < l21) l21 = distan2[i], u3 = i;
  }
  for (int i = 0; i < n; i++) {
    if (i == u1) continue;
    if (distan1[i] < l12) l12 = distan1[i];
  }
  for (int i = 0; i < n; i++) {
    if (i == u3) continue;
    if (distan2[i] < l22) l22 = distan2[i];
  }
  double jj = sum;
  if (u1 == u3) {
    sum += min(l11 + l22, l12 + l21);
  } else
    sum += l11 + l21;
  sum = min(sum, jj + l11);
  sum = min(sum, jj + l21);
  cout << setprecision(12) << sum;
}
