#include <bits/stdc++.h>
using namespace std;
double dist(int x1, int y1, int x2, int y2) {
  return sqrt((long long)(x1 - x2) * (x1 - x2) +
              (long long)(y1 - y2) * (y1 - y2));
}
int N, ax, ay, bx, by, tx, ty;
pair<int, int> v[100100];
double memo[100100][2][2];
double solve(int idx, int a, int b) {
  if (idx == N) {
    if (a || b) return 0.0;
    return 1e16;
  }
  if (fabs(memo[idx][a][b] + 1.0) > 1e-8) return memo[idx][a][b];
  double ans1 = 1e16, ans2 = 1e16, ans3 = 1e16;
  ans1 = solve(idx + 1, a, b) + 2 * dist(tx, ty, v[idx].first, v[idx].second);
  if (not a)
    ans2 = solve(idx + 1, 1, b) + dist(tx, ty, v[idx].first, v[idx].second) +
           dist(ax, ay, v[idx].first, v[idx].second);
  if (not b)
    ans3 = solve(idx + 1, a, 1) + dist(tx, ty, v[idx].first, v[idx].second) +
           dist(bx, by, v[idx].first, v[idx].second);
  return memo[idx][a][b] = min(ans1, min(ans2, ans3));
}
int main() {
  scanf("%d %d %d %d %d %d %d", &ax, &ay, &bx, &by, &tx, &ty, &N);
  for (int i = 0; i < N; i++) scanf("%d %d", &v[i].first, &v[i].second);
  for (int i = 0; i < 100100; i++) {
    for (int j = 0; j < 2; j++) {
      for (int k = 0; k < 2; k++) {
        memo[i][j][k] = -1.0;
      }
    }
  }
  printf("%.12f\n", solve(0, 0, 0));
  return 0;
}
