#include <bits/stdc++.h>
using namespace std;
double disa[100010], disb[100010], dist[100010];
double get(double x1, double y1, double x2, double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
int main() {
  double ax, ay, bx, by, tx, ty;
  while (scanf("%lf%lf%lf%lf%lf%lf", &ax, &ay, &bx, &by, &tx, &ty) != EOF) {
    int n;
    scanf("%d", &n);
    double sum = 0.0;
    for (int i = 1; i <= n; i++) {
      double x, y;
      scanf("%lf%lf", &x, &y);
      disa[i] = get(x, y, ax, ay);
      disb[i] = get(x, y, bx, by);
      dist[i] = get(x, y, tx, ty);
      sum += 2.0 * dist[i];
    }
    double ans = sum;
    double res = 1e20;
    for (int i = 1; i <= n; i++) {
      res = min(res, ans - dist[i] + disb[i]);
      ans = min(ans, sum - dist[i] + disa[i]);
    }
    ans = sum;
    for (int i = 1; i <= n; i++) {
      res = min(res, ans - dist[i] + disa[i]);
      ans = min(ans, sum - dist[i] + disb[i]);
    }
    printf("%.12lf\n", res);
  }
  return 0;
}
