#include <bits/stdc++.h>
using namespace std;
pair<double, double> p[100100];
double d[100100];
double dist(pair<double, double> x, pair<double, double> y) {
  double val = pow((x.first - y.first) * (x.first - y.first) +
                       (x.second - y.second) * (x.second - y.second),
                   0.5);
  return val;
}
int main() {
  pair<double, double> a, b, t;
  cin >> a.first >> a.second >> b.first >> b.second >> t.first >> t.second;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> p[i].first >> p[i].second;
  double ans = 0.0;
  for (int i = 0; i < n; i++) {
    d[i] = dist(t, p[i]);
    ans += d[i];
  }
  double val = 100000000000000000;
  double ma1 = 0, ma2 = 0, mb1 = 0, mb2 = 0;
  int ia1 = -1, ia2 = -1, ib1 = -1, ib2 = -1;
  for (int i = 0; i < n; i++) {
    val = min(val, 2 * ans + dist(a, p[i]) - d[i]);
    if (ma2 < d[i] - dist(a, p[i])) ma2 = d[i] - dist(a, p[i]), ia2 = i;
    if (ma1 < ma2) swap(ma1, ma2), swap(ia1, ia2);
  }
  for (int i = 0; i < n; i++) {
    val = min(val, 2 * ans + dist(b, p[i]) - d[i]);
    if (mb2 < d[i] - dist(b, p[i])) mb2 = d[i] - dist(b, p[i]), ib2 = i;
    if (mb1 < mb2) swap(mb1, mb2), swap(ib1, ib2);
  }
  if (ia1 != ib1 && ia1 != -1 && ib1 != -1) val = min(val, 2 * ans - ma1 - mb1);
  if (ia1 != ib2 && ia1 != -1 && ib2 != -1) val = min(val, 2 * ans - ma1 - mb2);
  if (ia2 != ib1 && ia2 != -1 && ib1 != -1) val = min(val, 2 * ans - ma2 - mb1);
  if (ia2 != ib2 && ia2 != -1 && ib2 != -1) val = min(val, 2 * ans - ma2 - mb2);
  printf("%0.14lf", val);
}
