#include <bits/stdc++.h>
using namespace std;
double distance(double x1, double y1, double x2, double y2) {
  return sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}
int main() {
  double ax, ay, bx, by, tx, ty;
  scanf("%lf%lf%lf%lf%lf%lf", &ax, &ay, &bx, &by, &tx, &ty);
  int n;
  scanf("%d", &n);
  double cdist[n], D = 0;
  pair<double, double> p[n];
  for (int i = 0; i < n; ++i) {
    scanf("%lf%lf", &p[i].first, &p[i].second);
    cdist[i] = distance(tx, ty, p[i].first, p[i].second);
    D += 2 * cdist[i];
  }
  set<pair<double, int> > A, B;
  double distA[n], distB[n];
  for (int i = 0; i < n; ++i) {
    double x = -cdist[i] + distance(ax, ay, p[i].first, p[i].second);
    distA[i] = x;
    A.insert({x, i});
    x = -cdist[i] + distance(bx, by, p[i].first, p[i].second);
    distB[i] = x;
    B.insert({x, i});
  }
  double temp1 = D + A.begin()->first;
  double temp2 = D + B.begin()->first;
  double temp3 = D + A.begin()->first;
  int idx = A.begin()->second;
  B.erase({distB[idx], idx});
  if (not B.empty()) temp3 += B.begin()->first;
  B.insert({distB[idx], idx});
  double temp4 = D + B.begin()->first;
  idx = B.begin()->second;
  A.erase({distA[idx], idx});
  if (not A.empty()) temp4 += A.begin()->first;
  double ans = min(min(temp1, temp2), min(temp3, temp4));
  printf("%lf\n", ans);
  return 0;
}
