#include <bits/stdc++.h>
using namespace std;
struct pnt {
  long double x, y;
};
pnt Ad, Bt, Rb;
int N;
pnt a[100100];
int b[100100], c[100100];
long double v1[100100], v2[100100];
long double dist(pnt A, pnt B) {
  return sqrt((A.x - B.x) * (A.x - B.x) + (A.y - B.y) * (A.y - B.y));
}
bool cmp1(int x, int y) {
  return (dist(a[x], Ad) - dist(Rb, a[x])) < (dist(a[y], Ad) - dist(Rb, a[y]));
}
bool cmp2(int x, int y) {
  return (dist(a[x], Bt) - dist(Rb, a[x])) < (dist(a[y], Bt) - dist(Rb, a[y]));
}
int main() {
  cin >> Ad.x >> Ad.y >> Bt.x >> Bt.y >> Rb.x >> Rb.y;
  cin >> N;
  int i;
  long double tot = 0, res;
  for (i = 1; i <= N; i++) {
    cin >> a[i].x >> a[i].y;
    tot += 2 * dist(a[i], Rb);
    b[i] = i;
    c[i] = i;
  }
  sort(b + 1, b + N + 1, cmp1);
  sort(c + 1, c + N + 1, cmp2);
  for (i = 1; i <= N; i++) {
    v1[i] = dist(a[b[i]], Ad) - dist(Rb, a[b[i]]);
    v2[i] = dist(a[c[i]], Bt) - dist(Rb, a[c[i]]);
  }
  res = tot + v1[1];
  res = min(res, tot + v2[1]);
  if (c[1] == b[1]) {
    res = min(res, tot + v1[1] + v2[2]);
    res = min(res, tot + v1[2] + v2[1]);
  } else
    res = min(res, tot + v1[1] + v2[1]);
  cout << fixed << setprecision(11) << res << "\n";
  return 0;
}
