#include <bits/stdc++.h>
using namespace std;
double Ax, Ay, Bx, By, Cx, Cy;
int n;
double a[211111], b[211111], o[211111];
pair<double, int> qa[211111], qb[211111];
double dist(double x, double y, double xx, double yy) {
  return sqrt((x - xx) * (x - xx) + (y - yy) * (y - yy));
}
int main() {
  ios::sync_with_stdio(false);
  cin >> Ax >> Ay >> Bx >> By >> Cx >> Cy >> n;
  double sum = 0;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    o[i] = dist(x, y, Cx, Cy) * 2;
    sum += o[i];
    a[i] = dist(x, y, Ax, Ay) + dist(x, y, Cx, Cy);
    b[i] = dist(x, y, Bx, By) + dist(x, y, Cx, Cy);
  }
  for (int i = 0; i < n; i++) {
    qa[i] = make_pair(a[i] - o[i], i);
    qb[i] = make_pair(b[i] - o[i], i);
  }
  sort(qa, qa + n);
  sort(qb, qb + n);
  double ans = 1e20;
  for (int i = 0; i < min(5, n); i++)
    for (int j = 0; j < min(5, n); j++)
      if (qa[i].second != qb[j].second) {
        double t = sum + qa[i].first + qb[j].first;
        ans = min(ans, t);
      }
  for (int i = 0; i < n; i++) {
    ans = min(ans, sum - o[i] + a[i]);
    ans = min(ans, sum - o[i] + b[i]);
  }
  printf("%.10lf\n", ans);
  return 0;
}
