#include <bits/stdc++.h>
using namespace ::std;
double dist(pair<int, int> &p1, pair<int, int> &p2) {
  double dx = (p1.first - p2.first);
  double dy = (p1.second - p2.second);
  return sqrt(dx * dx + dy * dy);
}
int main() {
  pair<int, int> A;
  pair<int, int> B;
  pair<int, int> Z;
  int x, y;
  scanf("%d", &x);
  scanf("%d", &y);
  A.first = x;
  A.second = y;
  scanf("%d", &x);
  scanf("%d", &y);
  B.first = x;
  B.second = y;
  scanf("%d", &x);
  scanf("%d", &y);
  Z.first = x;
  Z.second = y;
  int N;
  scanf("%d", &N);
  vector<pair<int, int> > D(N);
  for (int i = 0; i < N; i++) {
    scanf("%d", &x);
    scanf("%d", &y);
    D[i].first = x;
    D[i].second = y;
  }
  vector<pair<double, int> > P;
  vector<pair<double, int> > Q;
  P.reserve(N);
  Q.reserve(N);
  double sm = 0;
  for (int i = 0; i < N; i++) {
    double t = dist(Z, D[i]);
    P.push_back(make_pair(dist(A, D[i]) - t, i));
    Q.push_back(make_pair(dist(B, D[i]) - t, i));
    sm += 2.0 * t;
  }
  std::sort(P.begin(), P.end());
  std::sort(Q.begin(), Q.end());
  double ans = min(sm + P[0].first, sm + Q[0].first);
  if (P[0].second != Q[0].second) {
    ans = min(ans, sm + P[0].first + Q[0].first);
  } else {
    if (N > 1)
      ans = min(
          ans, min(sm + P[0].first + Q[1].first, sm + Q[0].first + P[1].first));
  }
  printf("%.7f\n", ans);
  return 0;
}
