#include <bits/stdc++.h>
using namespace std;
pair<long double, long double> a[100005];
long double isum = 0, min1 = 1000000000000, isum1, t[100005],
            min2 = 1000000000000, min3 = 1000000000000, min4 = 1000000000000,
            min5 = 1000000000000;
int i, j;
long long ax, ay, bx, by, tx, ty, n, x[100005], y[100005], h, k;
bool used[100005];
int main() {
  cin >> ax >> ay >> bx >> by >> tx >> ty >> n;
  for (i = 0; i < 100005; i++) used[i] = 0;
  for (i = 0; i < n; i++) {
    cin >> x[i];
    cin >> y[i];
  }
  a[n].first = 0;
  a[n].second = 0;
  for (i = 0; i < n; i++) {
    t[i] = sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
    a[i].first =
        sqrt((ax - x[i]) * (ax - x[i]) + (ay - y[i]) * (ay - y[i])) - t[i];
    a[i].second =
        sqrt((bx - x[i]) * (bx - x[i]) + (by - y[i]) * (by - y[i])) - t[i];
    isum += 2 * t[i];
  }
  sort(a, a + n);
  for (i = 0; i < n; i++) {
    min2 = min(min2, a[i].first);
  }
  for (i = 0; i < n; i++) {
    if (a[i].first == min2) {
      h = i;
      break;
    }
  }
  for (i = 0; i < n; i++) {
    if (i != h) min3 = min(min3, a[i].first);
  }
  for (i = 0; i < n; i++) {
    min4 = min(min4, a[i].second);
  }
  for (i = 0; i < n; i++) {
    if (a[i].second == min4) {
      k = i;
      break;
    }
  }
  for (i = 0; i < n; i++) {
    if (i != k) min5 = min(min5, a[i].second);
  }
  if (h != k) {
    min1 = min(min1, min2 + min4);
  } else {
    min1 = min(min1, min2 + min5);
    min1 = min(min1, min3 + min4);
    min1 = min(min1, min3 + min5);
  }
  for (i = 0; i < n; i++) min1 = min(a[i].first, min1);
  for (i = 0; i < n; i++) min1 = min(a[i].second, min1);
  cout << fixed << setprecision(12) << isum + min1;
}
