#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return a % b == 0 ? b : gcd(b, a % b); }
const int MAXN = 100010;
struct node {
  double x, y;
  int idx;
  double sumdis;
  friend bool operator<(const node &a, const node &b) {
    return a.sumdis < b.sumdis;
  }
} A[MAXN], B[MAXN];
int N;
double ax, ay, bx, by, tx, ty;
double dist(double x1, double y1, double x2, double y2) {
  double val = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
  return sqrt(val);
}
int main() {
  scanf("%lf%lf%lf%lf%lf%lf", &ax, &ay, &bx, &by, &tx, &ty);
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    scanf("%lf%lf", &A[i].x, &A[i].y);
    A[i].idx = i;
    B[i].idx = i;
    B[i].x = A[i].x;
    B[i].y = A[i].y;
    A[i].sumdis = dist(ax, ay, A[i].x, A[i].y) + dist(tx, ty, A[i].x, A[i].y);
    B[i].sumdis = dist(bx, by, B[i].x, B[i].y) + dist(tx, ty, B[i].x, B[i].y);
  }
  sort(A + 1, A + 1 + N);
  sort(B + 1, B + 1 + N);
  double sum = 0.0;
  double ans = 1e18;
  for (int i = 1; i <= N; i++) sum += dist(A[i].x, A[i].y, tx, ty) * 2;
  for (int i = 1; i <= N && i <= 1000; i++) {
    for (int j = 1; j <= N && j <= 1000; j++) {
      if (A[i].idx == B[j].idx) continue;
      ans = min(ans, sum - dist(A[i].x, A[i].y, tx, ty) * 2 -
                         dist(B[j].x, B[j].y, tx, ty) * 2 + A[i].sumdis +
                         B[j].sumdis);
    }
  }
  for (int i = 1; i <= N; i++)
    ans = min(ans, sum - dist(A[i].x, A[i].y, tx, ty) * 2 + A[i].sumdis);
  for (int i = 1; i <= N; i++)
    ans = min(ans, sum - dist(B[i].x, B[i].y, tx, ty) * 2 + B[i].sumdis);
  printf("%.12lf\n", ans);
  return 0;
}
