#include <bits/stdc++.h>
using namespace std;
int n, ax, ay, bx, by, tx, ty;
int main() {
  while (cin >> ax >> ay >> bx >> by >> tx >> ty >> n) {
    vector<double> X(n), Y(n), dis(n);
    for (int i = 0; i < (int)n; ++i) scanf("%lf%lf", &X[i], &Y[i]);
    double sum = 0;
    for (int i = 0; i < (int)n; ++i) {
      dis[i] = hypot(X[i] - tx, Y[i] - ty) * 2.0;
      sum += dis[i];
    }
    vector<pair<double, int>> ali(n), bob(n);
    for (int i = 0; i < (int)n; ++i)
      ali[i] = {hypot(X[i] - ax, Y[i] - ay) + hypot(X[i] - tx, Y[i] - ty), i};
    for (int i = 0; i < (int)n; ++i)
      bob[i] = {hypot(X[i] - bx, Y[i] - by) + hypot(X[i] - tx, Y[i] - ty), i};
    double ans = 1e30;
    if (n == 1) {
      ans = min(ali[0].first, bob[0].first);
      printf("%0.20f\n", ans);
      continue;
    }
    for (int i = 0; i < (int)n; ++i)
      (ans) = min((ans), (ali[i].first + sum - dis[ali[i].second]));
    for (int i = 0; i < (int)n; ++i)
      (ans) = min((ans), (bob[i].first + sum - dis[bob[i].second]));
    for (int i = 0; i < (int)n; ++i) ali[i].first -= dis[ali[i].second];
    for (int i = 0; i < (int)n; ++i) bob[i].first -= dis[bob[i].second];
    sort((ali).begin(), (ali).end());
    sort((bob).begin(), (bob).end());
    for (int i = 0; i < (int)min(3000, n); ++i)
      for (int j = 0; j < (int)min(3000, n); ++j)
        if (ali[i].second != bob[j].second) {
          double a, b, d;
          a = ali[i].first;
          b = bob[j].first;
          d = sum + a + b;
          (ans) = min((ans), (d));
        }
    printf("%0.20f\n", ans);
  }
}
