#include <bits/stdc++.h>
using namespace std;
const int maxn = 100500;
int n;
int x[maxn], y[maxn];
double dist(int i, int j) {
  double dx = x[i] - x[j];
  double dy = y[i] - y[j];
  return sqrtl(dx * dx + dy * dy);
}
void scan() {
  int a, b, c, d, e, f;
  scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f);
  scanf("%d", &n);
  for (int i = 0; i < (int)(n); ++i) scanf("%d%d", &x[i], &y[i]);
  tie(x[n], y[n], x[n + 1], y[n + 1], x[n + 2], y[n + 2]) =
      tie(a, b, c, d, e, f);
}
pair<double, int> u1[maxn], u2[maxn];
void solve() {
  double score = 0;
  for (int i = 0; i < (int)(n); ++i) score += 2 * dist(i, n + 2);
  for (int i = 0; i < (int)(n); ++i) {
    u1[i] = {dist(i, n + 2) - dist(i, n), i};
    u2[i] = {dist(i, n + 2) - dist(i, n + 1), i};
  }
  sort(u1, u1 + n);
  reverse(u1, u1 + n);
  sort(u2, u2 + n);
  reverse(u2, u2 + n);
  double best = -1e40;
  best = max(best, u1[0].first);
  best = max(best, u2[0].first);
  for (int i = 0; i < (int)(min(2, n)); ++i)
    for (int j = 0; j < (int)(min(2, n)); ++j) {
      if (u1[i].second != u2[j].second) {
        best = max(best, u1[i].first + u2[j].first);
      }
    }
  cout.precision(10);
  cout << fixed << score - best << endl;
}
int main() {
  scan();
  solve();
  return 0;
}
