#include <bits/stdc++.h>
using namespace std;
int n;
pair<int, int> a, b, c, vet[101010];
long double dist(pair<int, int> a, pair<int, int> b) {
  return hypot((long double)a.first - b.first,
               (long double)a.second - b.second);
}
int main() {
  scanf("%d%d%d%d%d%d", &a.first, &a.second, &b.first, &b.second, &c.first,
        &c.second);
  scanf("%d", &n);
  long double ans = dist(a, c) + dist(b, c);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &vet[i].first, &vet[i].second);
    ans += 2 * dist(c, vet[i]);
  }
  long double difa1 = 0, difb1 = 0, difa2 = 0, difb2 = 0;
  int ida1 = 0, ida2 = 0, idb1 = 0, idb2 = 0;
  for (int i = 0; i < n; i++) {
    if (dist(a, c) + 2 * dist(c, vet[i]) - dist(a, vet[i]) - dist(vet[i], c) >
        difa2) {
      difa2 =
          dist(a, c) + 2 * dist(c, vet[i]) - dist(a, vet[i]) - dist(vet[i], c);
      ida2 = i;
    }
    if (difa2 > difa1) swap(difa2, difa1), swap(ida2, ida1);
    if (dist(b, c) + 2 * dist(c, vet[i]) - dist(b, vet[i]) - dist(vet[i], c) >
        difb2) {
      difb2 =
          dist(b, c) + 2 * dist(c, vet[i]) - dist(b, vet[i]) - dist(vet[i], c);
      idb2 = i;
    }
    if (difb2 > difb1) swap(difb2, difb1), swap(idb2, idb1);
  }
  long double tdif;
  if (ida1 != idb1)
    tdif = difa1 + difb1;
  else
    tdif = max(difa1 + difb2, difa2 + difb1);
  tdif = max(tdif, difb1 + dist(a, c));
  tdif = max(tdif, difa1 + dist(b, c));
  ans -= tdif;
  cout << setprecision(20) << ans << endl;
}
