#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 50;
const long long inf = 1e18;
double res;
long long n;
pair<long long, long long> a;
pair<long long, long long> b;
pair<long long, long long> p;
pair<long long, long long> po[maxn];
void init() {
  long long x, y;
  scanf("%lld%lld", &x, &y);
  a = make_pair(x, y);
  ;
  scanf("%lld%lld", &x, &y);
  b = make_pair(x, y);
  ;
  scanf("%lld%lld", &x, &y);
  p = make_pair(x, y);
  ;
  scanf("%lld", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld%lld", &x, &y);
    po[i] = make_pair(x, y);
    ;
  }
  res = 0;
}
double d(long long px, long long py, long long x, long long y) {
  return sqrt(1.0 * (px - x) * (px - x) + 1.0 * (py - y) * (py - y));
}
void solve() {
  double alldis = 0;
  double tmp = (double)inf * -1.0;
  long long apos, bpos;
  for (int i = 1; i <= n; i++) {
    long long x = po[i].first, y = po[i].second;
    double t1 = d(x, y, p.first, p.second);
    double t2 = d(a.first, a.second, x, y);
    alldis += 2.0 * t1;
    if (t1 - t2 >= tmp) {
      tmp = t1 - t2;
      apos = i;
    }
  }
  double resa = alldis - tmp;
  tmp = (double)inf * -1.0;
  for (int i = 1; i <= n; i++) {
    long long x = po[i].first, y = po[i].second;
    double t1 = d(x, y, p.first, p.second);
    double t2 = d(b.first, b.second, x, y);
    if (t1 - t2 >= tmp) {
      tmp = t1 - t2;
      bpos = i;
    }
  }
  double resb = alldis - tmp;
  tmp = (double)inf * -1.0;
  for (int i = 1; i <= n; i++) {
    if (i == apos) continue;
    long long x = po[i].first, y = po[i].second;
    double t1 = d(x, y, p.first, p.second);
    double t2 = d(b.first, b.second, x, y);
    tmp = max(tmp, t1 - t2);
  }
  double resab = resa - tmp;
  tmp = (double)inf * -1;
  for (int i = 1; i <= n; i++) {
    if (i == bpos) continue;
    long long x = po[i].first, y = po[i].second;
    double t1 = d(x, y, p.first, p.second);
    double t2 = d(a.first, a.second, x, y);
    tmp = max(tmp, t1 - t2);
  }
  double resba = resb - tmp;
  res = inf;
  res = min(min(resa, resb), min(resab, resba));
  printf("%.15f\n", res);
}
int main() {
  init();
  solve();
  return 0;
}
