#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 100;
const long double INF = 2e30;
struct node {
  int id;
  long double da, db, len;
  node(int _id = 0, long double _da = 0, long double _db = 0,
       long double _len = 0) {
    id = _id;
    da = _da;
    db = _db;
    len = _len;
  }
};
node a[maxn];
int n;
double ax, ay, bx, by, tx, ty;
double x[maxn], y[maxn];
long double len[maxn], da[maxn], db[maxn];
bool cmpb(node a, node b) {
  long double ans1 = a.db - a.len;
  long double ans2 = b.db - b.len;
  return ans1 < ans2;
}
bool cmpa(node a, node b) {
  long double ans1 = a.da - a.len;
  long double ans2 = b.da - b.len;
  return ans1 < ans2;
}
void solve() {
  long double sum = 0;
  for (int i = 0; i < n; i++) {
    a[i].id = i;
    long double dx, dy;
    dx = ax - x[i];
    dy = ay - y[i];
    a[i].da = sqrt(dx * dx + dy * dy);
    dx = bx - x[i];
    dy = by - y[i];
    a[i].db = sqrt(dx * dx + dy * dy);
    dx = tx - x[i];
    dy = ty - y[i];
    a[i].len = sqrt(dx * dx + dy * dy);
    sum += a[i].len * 2;
    len[i] = a[i].len;
    da[i] = a[i].da;
    db[i] = a[i].db;
  }
  long double ans = INF;
  sort(a, a + n, cmpb);
  for (int i = 0; i < n; i++) {
    if (n > 1) {
      int id = a[0].id;
      if (i == id) {
        id = a[1].id;
      }
      long double tmp = sum - len[i] + da[i] - len[id] + db[id];
      ans = min(ans, tmp);
    }
    long double tmp = sum - len[i] + da[i];
    ans = min(ans, tmp);
  }
  sort(a, a + n, cmpa);
  for (int i = 0; i < n; i++) {
    if (n > 1) {
      int id = a[0].id;
      if (i == id) {
        id = a[1].id;
      }
      long double tmp = sum - len[i] + db[i] - len[id] + da[id];
      ans = min(ans, tmp);
    }
    long double tmp = sum - len[i] + db[i];
    ans = min(ans, tmp);
  }
  printf("%.14f\n", (double)ans);
}
int main() {
  while (scanf("%lf%lf%lf%lf%lf%lf", &ax, &ay, &bx, &by, &tx, &ty) != EOF) {
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
      scanf("%lf%lf", &x[i], &y[i]);
    }
    solve();
  }
  return 0;
}
