#include <bits/stdc++.h>
using namespace std;
int main() {
  long long ax, ay, bx, by, tx, ty;
  scanf("%I64d %I64d %I64d %I64d %I64d %I64d", &ax, &ay, &bx, &by, &tx, &ty);
  int n;
  scanf("%d", &n);
  vector<pair<long long, long long> > bottles(n);
  for (int i = 0; i < n; i++) {
    long long foo, bar;
    scanf("%I64d %I64d", &foo, &bar);
    bottles[i] = make_pair(foo, bar);
  }
  double ans = 0.0;
  for (int i = 0; i < n; i++) {
    ans += 2 * sqrt((bottles[i].first - tx) * (bottles[i].first - tx) +
                    (bottles[i].second - ty) * (bottles[i].second - ty));
  }
  double dubbel = ans;
  double adil = 1e18;
  for (int i = 0; i < n; i++) {
    double betalen1 =
        dubbel + sqrt((bottles[i].first - ax) * (bottles[i].first - ax) +
                      (bottles[i].second - ay) * (bottles[i].second - ay));
    betalen1 -= sqrt((bottles[i].first - tx) * (bottles[i].first - tx) +
                     (bottles[i].second - ty) * (bottles[i].second - ty));
    adil = min(adil, betalen1);
  }
  double bera = 1e18;
  for (int i = 0; i < n; i++) {
    double betalen1 =
        dubbel + sqrt((bottles[i].first - bx) * (bottles[i].first - bx) +
                      (bottles[i].second - by) * (bottles[i].second - by));
    betalen1 -= sqrt((bottles[i].first - tx) * (bottles[i].first - tx) +
                     (bottles[i].second - ty) * (bottles[i].second - ty));
    bera = min(bera, betalen1);
  }
  vector<pair<double, int> > best(2, make_pair(1e18, -1));
  for (int i = 0; i < n; i++) {
    double bijtellen =
        sqrt((bottles[i].first - ax) * (bottles[i].first - ax) +
             (bottles[i].second - ay) * (bottles[i].second - ay)) -
        sqrt((bottles[i].first - tx) * (bottles[i].first - tx) +
             (bottles[i].second - ty) * (bottles[i].second - ty));
    pair<double, int> now = make_pair(bijtellen, i);
    for (int j = 0; j < 2; j++) {
      if (now < best[j]) {
        swap(best[j], now);
      }
    }
  }
  double beiden = 1e18;
  for (int i = 0; i < n; i++) {
    double total =
        dubbel + sqrt((bottles[i].first - bx) * (bottles[i].first - bx) +
                      (bottles[i].second - by) * (bottles[i].second - by));
    total -= sqrt((bottles[i].first - tx) * (bottles[i].first - tx) +
                  (bottles[i].second - ty) * (bottles[i].second - ty));
    if (i == best[0].second) {
      total += best[1].first;
    } else {
      total += best[0].first;
    }
    beiden = min(beiden, total);
  }
  double antwoord = min(adil, min(bera, beiden));
  printf("%.15lf\n", antwoord);
  return 0;
}
