#include <bits/stdc++.h>
using namespace std;
int main() {
  int ax, ay, bx, by, tx, ty;
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  complex<double> a(ax, ay), b(bx, by), t(tx, ty);
  int n, x, y;
  cin >> n;
  if (n == 0) {
    cout << "0" << endl;
    return 0;
  }
  vector<complex<double>> btl;
  for (int i = 0; i < n; ++i) {
    cin >> x >> y;
    btl.emplace_back(x, y);
  }
  vector<pair<double, int>> a_rank(n), b_rank(n);
  for (int i = 0; i < n; ++i) {
    a_rank[i].first = abs(a - btl[i]);
    a_rank[i].second = i;
    b_rank[i].first = abs(b - btl[i]);
    b_rank[i].second = i;
  }
  sort(begin(a_rank), end(a_rank));
  sort(begin(b_rank), end(b_rank));
  double base = 0;
  for (int i = 0; i < n; ++i) {
    base += abs(t - btl[i]) * 2.0;
  }
  double ans = 1e100;
  ans = min(ans, base - abs(t - btl[a_rank[0].second]) + a_rank[0].first);
  ans = min(ans, base - abs(t - btl[b_rank[0].second]) + b_rank[0].first);
  for (int i = 0; i < n; ++i) {
    ans = min(ans, base - abs(t - btl[a_rank[i].second]) + a_rank[i].first);
    ans = min(ans, base - abs(t - btl[b_rank[i].second]) + b_rank[i].first);
  }
  n = min(n, 1000);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (a_rank[i].second != b_rank[j].second) {
        ans = min(ans, base - abs(t - btl[a_rank[i].second]) + a_rank[i].first -
                           abs(t - btl[b_rank[j].second]) + b_rank[j].first);
      }
    }
  }
  printf("%.15f\n", ans);
}
