#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> num[100005];
double dt[100005], db[100005];
double lmin[100005], rmin[100005];
double getdt(pair<long long, long long> a, pair<long long, long long> b) {
  return sqrt((a.first - b.first) * (a.first - b.first) +
              (a.second - b.second) * (a.second - b.second));
}
int main() {
  long long ax, ay, bx, by, tx, ty;
  scanf("%lld %lld %lld %lld %lld %lld", &ax, &ay, &bx, &by, &tx, &ty);
  int n;
  scanf("%d", &n);
  double tot = 0;
  for (int i = (1); i <= (n); i += (1)) {
    scanf("%lld %lld", &num[i].first, &num[i].second);
    dt[i] = getdt(num[i], {tx, ty});
    db[i] = getdt(num[i], {bx, by}) - dt[i];
    tot += dt[i] * 2;
  }
  lmin[0] = 1000000000000000000;
  for (int i = (1); i <= (n); i += (1)) {
    lmin[i] = min(lmin[i - 1], db[i]);
  }
  rmin[n + 1] = 1000000000000000000;
  for (int i = (n); i >= (1); i -= (1)) {
    rmin[i] = min(rmin[i + 1], db[i]);
  }
  double ans = 1000000000000000000, amin = 1000000000000000000;
  for (int i = (1); i <= (n); i += (1)) {
    ans = min(ans, tot + getdt(num[i], {ax, ay}) - dt[i] +
                       min(lmin[i - 1], rmin[i + 1]));
    amin = min(amin, getdt(num[i], {ax, ay}) - dt[i]);
  }
  ans = min(ans, min(tot + amin, tot + lmin[n]));
  printf("%.6lf\n", ans);
  return 0;
}
