#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
void setmin(double &a, double b) {
  if (a > b) {
    a = b;
  }
}
int AX, AY, BX, BY, TX, TY;
int N, X[MAXN], Y[MAXN];
double T;
double totgo(int sx, int sy) {
  double mn = HUGE_VAL;
  for (int i = 0; i < N; i++) {
    setmin(mn, hypot(sx - X[i], sy - Y[i]) - hypot(X[i] - TX, Y[i] - TY));
  }
  return T + mn;
}
vector<pair<double, int> > getmn(int sx, int sy) {
  vector<pair<double, int> > v;
  for (int i = 0; i < N; i++) {
    v.push_back(make_pair(
        hypot(sx - X[i], sy - Y[i]) - hypot(X[i] - TX, Y[i] - TY), i));
  }
  vector<pair<double, int> > res;
  for (int i = 0; i < 2; i++) {
    auto it = min_element((v).begin(), (v).end());
    res.push_back(*it);
    v.erase(it);
  }
  return res;
}
int main() {
  if (fopen("input.txt", "r")) {
    freopen("input.txt", "r", stdin);
  }
  scanf("%d %d %d %d", &AX, &AY, &BX, &BY);
  scanf("%d %d %d", &TX, &TY, &N);
  for (int i = 0; i < N; i++) {
    scanf("%d %d", &X[i], &Y[i]);
    T += hypot(X[i] - TX, Y[i] - TY);
  }
  T *= 2;
  if (N == 1) {
    printf("%.15lf\n",
           min(hypot(AX - X[0], AY - Y[0]), hypot(BX - X[0], BY - Y[0])) +
               hypot(X[0] - TX, Y[0] - TY));
    return 0;
  }
  double ans = min(totgo(AX, AY), totgo(BX, BY));
  auto v1 = getmn(AX, AY), v2 = getmn(BX, BY);
  double go2 = HUGE_VAL;
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      if (v1[i].second != v2[j].second) {
        setmin(go2, v1[i].first + v2[j].first);
      }
    }
  }
  setmin(ans, go2 + T);
  printf("%.15lf\n", ans);
}
