#include <bits/stdc++.h>
using namespace std;
int n;
struct point {
  double x, y;
} a, b, t, q[100010];
struct wxz {
  double d1, d2;
} f[100010];
double ans, delta1[100010], delta2[100010], delta;
double dist(point u, point v) {
  return sqrt((u.x - v.x) * (u.x - v.x) + (u.y - v.y) * (u.y - v.y));
}
bool vis[100010];
int main() {
  scanf("%lf%lf%lf%lf%lf%lf", &a.x, &a.y, &b.x, &b.y, &t.x, &t.y);
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%lf%lf", &q[i].x, &q[i].y);
  for (int i = 1; i <= n; i++) ans += 2 * dist(t, q[i]);
  for (int i = 1; i <= n; i++) f[i].d1 = dist(a, q[i]) - dist(t, q[i]);
  for (int i = 1; i <= n; i++) f[i].d2 = dist(b, q[i]) - dist(t, q[i]);
  double delta = 1e18, dd1 = 1e18, dd2 = 1e18;
  for (int i = 1; i <= n; i++) {
    delta = min(delta, min(dd1 + f[i].d2, dd2 + f[i].d1));
    dd1 = min(dd1, f[i].d1), dd2 = min(dd2, f[i].d2);
  }
  printf("%lf\n", ans + min(delta, min(dd1, dd2)));
  return 0;
}
