#include <bits/stdc++.h>
using namespace std;
pair<int, int> a, b, c;
pair<int, int> p[111111];
int n;
pair<double, double> e[111111];
double dist(pair<int, int> a, pair<int, int> b) {
  return sqrt(1.0 * (a.first - b.first) * (a.first - b.first) +
              1.0 * (a.second - b.second) * (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);
  double res = 0.0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &p[i].first, &p[i].second);
    res += 2.0 * dist(c, p[i]);
    e[i].first = dist(c, p[i]) - dist(a, p[i]);
    e[i].second = dist(c, p[i]) - dist(b, p[i]);
  }
  sort(e, e + n, greater<pair<double, double> >());
  double mx = e[0].second;
  double otm = max(e[0].first, e[0].second);
  for (int i = 1; i < n; i++) {
    otm = max(otm, max(e[i].first, e[i].second));
    otm = max(otm, e[0].first + e[i].second);
    otm = max(otm, mx + e[i].first);
    mx = max(mx, e[i].second);
  }
  printf("%.10lf\n", res - otm);
  return 0;
}
