#include <bits/stdc++.h>
using namespace std;
int main() {
  double x[3], y[3];
  for (int i = 0; i < 3; i++) {
    cin >> x[i] >> y[i];
  }
  int n;
  cin >> n;
  vector<pair<double, double> > a(n);
  double L = 0;
  vector<pair<double, int> > dist0(n), dist1(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
    double dx = a[i].first - x[2];
    double dy = a[i].second - y[2];
    L += sqrt(dx * dx + dy * dy);
    dx = a[i].first - x[0];
    dy = a[i].second - y[0];
    double dx1 = a[i].first - x[2];
    double dy1 = a[i].second - y[2];
    dist0[i] =
        make_pair(sqrt(dx * dx + dy * dy) - sqrt(dx1 * dx1 + dy1 * dy1), i);
    dx = a[i].first - x[1];
    dy = a[i].second - y[1];
    dist1[i] =
        make_pair(sqrt(dx * dx + dy * dy) - sqrt(dx1 * dx1 + dy1 * dy1), i);
  }
  L *= 2;
  sort(dist0.begin(), dist0.end());
  sort(dist1.begin(), dist1.end());
  double ans[3];
  int i = dist0[0].second;
  ans[0] = L + dist0[0].first;
  i = dist1[0].second;
  ans[1] = L + dist1[0].first;
  ans[2] = 1e15;
  for (int i = 0; i < min(n, 2); i++) {
    for (int j = 0; j < min(n, 2); j++) {
      int fir = dist0[i].second;
      int sec = dist1[j].second;
      if (fir == sec) continue;
      ans[2] = min(ans[2], L + dist0[i].first + dist1[j].first);
    }
  }
  cout << fixed << setprecision(7);
  cout << min(ans[0], min(ans[1], ans[2]));
}
