#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 5;
const double inf = 1e60;
double s[N];
struct sta {
  double a, b;
  bool operator<(const sta &s) const { return a < s.a; }
} t[N];
double ax, ay, bx, by, tx, ty;
double x[N], y[N];
double sqr(double x) { return x * x; }
int main() {
  scanf("%lf%lf%lf%lf%lf%lf", &ax, &ay, &bx, &by, &tx, &ty);
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lf%lf", &x[i], &y[i]);
  double sum = 0, sa = sqrt(sqr(ax - tx) + sqr(ay - ty)),
         sb = sqrt(sqr(bx - tx) + sqr(by - ty));
  for (int i = 1; i <= n; i++)
    s[i] = 2 * sqrt(sqr(x[i] - tx) + sqr(y[i] - ty)), sum += s[i];
  for (int i = 1; i <= n; i++)
    t[i] = (sta){sqrt(sqr(ax - x[i]) + sqr(ay - y[i])) - s[i] * 0.5,
                 sqrt(sqr(bx - x[i]) + sqr(by - y[i])) - s[i] * 0.5};
  sort(t + 1, t + 1 + n);
  double ans = sum + sa + sb;
  for (int i = 1; i <= n; i++) {
    ans = min(ans, sum + t[i].a);
    ans = min(ans, sum + t[i].b);
    if (i == 1)
      ans = min(ans, sum + t[2].a + t[i].b);
    else
      ans = min(ans, sum + t[1].a + t[i].b);
  }
  printf("%.12lf\n", ans);
  return 0;
}
