#include <bits/stdc++.h>
using namespace std;
complex<double> read() {
  long long x, y;
  cin >> x >> y;
  return complex<double>(x, y);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  complex<double> A = read();
  complex<double> B = read();
  complex<double> T = read();
  long long N;
  cin >> N;
  vector<complex<double>> pts(N);
  for (complex<double>& p : pts) {
    p = read();
  }
  double sum = 0.0;
  for (complex<double>& p : pts) {
    sum += 2 * abs(p - T);
  }
  vector<pair<double, long long>> aval, bval;
  for (long long i = 0; i < N; ++i) {
    aval.push_back({abs(A - pts[i]) - abs(pts[i] - T), i});
    bval.push_back({abs(B - pts[i]) - abs(pts[i] - T), i});
  }
  sort(aval.begin(), aval.end());
  sort(bval.begin(), bval.end());
  double res = 1e99;
  for (long long i = 0; i < min(N, 2LL); ++i) {
    res = min(res, sum + aval[i].first);
    res = min(res, sum + bval[i].first);
    for (long long j = 0; j < min(N, 2LL); ++j) {
      if (aval[i].second != bval[j].second) {
        res = min(res, sum + aval[i].first + bval[j].first);
      }
    }
  }
  cout << fixed << setprecision(7) << res << endl;
  return 0;
}
