#include <bits/stdc++.h>
using namespace std;
struct ss {
  long long x, y, bh;
} g_[1000000 << 1];
struct aa {
  int bh;
  double dis;
  bool operator<(aa b) const { return dis < b.dis; }
} a[1000000 << 1], b[1000000 << 1], t[1000000 << 1];
long long ax, ay, bx, by, tx, ty, n;
int main() {
  scanf("%I64d%I64d%I64d%I64d%I64d%I64d", &ax, &ay, &bx, &by, &tx, &ty);
  scanf("%I64d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%I64d%I64d", &g_[i].x, &g_[i].y);
    g_[i].bh = i;
  }
  for (int i = 1; i <= n; i++) {
    t[i].dis = sqrt((double)(g_[i].x - tx) * (g_[i].x - tx) +
                    (g_[i].y - ty) * (g_[i].y - ty));
    t[i].bh = g_[i].bh;
    a[i].dis = sqrt((double)(g_[i].x - ax) * (g_[i].x - ax) +
                    (g_[i].y - ay) * (g_[i].y - ay)) -
               t[i].dis;
    a[i].bh = g_[i].bh;
    b[i].dis = sqrt((double)(g_[i].x - bx) * (g_[i].x - bx) +
                    (g_[i].y - by) * (g_[i].y - by)) -
               t[i].dis;
    b[i].bh = g_[i].bh;
  }
  sort(a + 1, a + n + 1), sort(b + 1, b + n + 1);
  double ans = 0;
  for (int i = 1; i <= n; i++) ans += (t[i].dis * 2);
  {
    if (a[1].bh != b[1].bh) {
      ans += min(a[1].dis, min(b[1].dis, a[1].dis + b[1].dis));
      printf("%0.12lf", ans);
      return 0;
    }
    if (a[1].bh == b[1].bh) {
      ans += min(a[1].dis,
                 min(b[1].dis, min(a[1].dis + b[2].dis, a[2].dis + b[1].dis)));
      printf("%0.12lf", ans);
      return 0;
    }
  }
  return 0;
}
