#include <bits/stdc++.h>
using namespace std;
pair<double, int> p[100010], pp[100010];
double x[100010], y[100010];
int main() {
  double ax, ay, bx, by, tx, ty;
  double res, val;
  int N;
  double l, ans;
  scanf("%lf%lf%lf%lf%lf%lf", &ax, &ay, &bx, &by, &tx, &ty);
  scanf("%d", &N);
  for (int i = (0); i < (N); i++) scanf("%lf%lf", x + i, y + i);
  res = 0.0;
  for (int i = (0); i < (N); i++) res += 2 * hypot(x[i] - tx, y[i] - ty);
  for (int i = (0); i < (N); i++) {
    l = hypot(x[i] - ax, y[i] - ay) - hypot(x[i] - tx, y[i] - ty);
    p[i] = pair<double, int>(l, i);
    l = hypot(x[i] - bx, y[i] - by) - hypot(x[i] - tx, y[i] - ty);
    pp[i] = pair<double, int>(l, i);
  }
  sort(p, p + N);
  sort(pp, pp + N);
  ans = 1e100;
  ans = min(ans, res + p[0].first);
  ans = min(ans, res + pp[0].first);
  if (p[0].second == pp[0].second) {
    if (N > 1) {
      ans = min(ans, res + p[0].first + pp[1].first);
      ans = min(ans, res + pp[0].first + p[1].first);
    }
  } else
    ans = min(ans, res + p[0].first + pp[0].first);
  printf("%.10lf\n", ans);
  return 0;
}
