#include <bits/stdc++.h>
using namespace std;
const int N = 100 * 1000 + 5;
double dustbin_dist[N], a_dist[N], b_dist[N], total = 0,
                                              ans = 1000000000000000000;
int main() {
  double ax, ay, bx, by, tx, ty, n, x, y;
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  cin >> n;
  vector<pair<double, int>> a, b;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    dustbin_dist[i] = sqrt((tx - x) * (tx - x) + (ty - y) * (ty - y));
    total += 2 * sqrt((tx - x) * (tx - x) + (ty - y) * (ty - y));
    a_dist[i] = sqrt((ax - x) * (ax - x) + (ay - y) * (ay - y));
    b_dist[i] = sqrt((bx - x) * (bx - x) + (by - y) * (by - y));
    a.push_back({a_dist[i] - dustbin_dist[i], i});
    b.push_back({b_dist[i] - dustbin_dist[i], i});
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  auto update_min = [&](int i, int j) {
    double val = total;
    val += (i == -1 ? 0 : a_dist[i] - dustbin_dist[i]);
    val += (j == -1 ? 0 : b_dist[j] - dustbin_dist[j]);
    ans = min(ans, val);
  };
  update_min(a[0].second, -1);
  update_min(-1, b[0].second);
  if (a[0].second != b[0].second) {
    update_min(a[0].second, b[0].second);
  } else if (n > 1) {
    if (a[0].second != b[1].second) update_min(a[0].second, b[1].second);
    if (a[1].second != b[0].second) update_min(a[1].second, b[0].second);
  }
  printf("%.10lf\n", ans);
}
