#include <bits/stdc++.h>
using namespace std;
void FastIO() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  cout.precision(15);
}
int main() {
  FastIO();
  double ax, ay, bx, by, tx, ty, sum = 0;
  int i = 0, n;
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  cin >> n;
  vector<pair<double, double> > v;
  vector<double> r, a1, b1;
  vector<pair<double, int> > a, b;
  v.resize(n);
  for (i = 0; i < n; i++) cin >> v[i].first >> v[i].second;
  for (i = 0; i < n; i++) {
    r.push_back(sqrt((v[i].first - tx) * (v[i].first - tx) +
                     (v[i].second - ty) * (v[i].second - ty)));
    sum = sum + 2 * r[i];
    a.push_back(make_pair(sqrt((v[i].first - ax) * (v[i].first - ax) +
                               (v[i].second - ay) * (v[i].second - ay)) -
                              r[i],
                          i));
    b.push_back(make_pair(sqrt((v[i].first - bx) * (v[i].first - bx) +
                               (v[i].second - by) * (v[i].second - by)) -
                              r[i],
                          i));
    a1.push_back(a[i].first + r[i]);
    b1.push_back(b[i].first + r[i]);
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  if (n == 1) {
    cout << ((a1[0] + r[0] < b1[0] + r[0]) ? a1[0] + r[0] : b1[0] + r[0])
         << "\n";
    return 0;
  }
  double ans = 1e18;
  for (i = 0; i < n; i++) {
    ans = ((ans < sum + a1[i] - r[i]) ? ans : sum + a1[i] - r[i]);
    if (b[0].second == i)
      ans = ((ans < sum + a1[i] - r[i] + b[1].first)
                 ? ans
                 : sum + a1[i] - r[i] + b[1].first);
    else
      ans = ((ans < sum + a1[i] - r[i] + b[0].first)
                 ? ans
                 : sum + a1[i] - r[i] + b[0].first);
  }
  for (i = 0; i < n; i++) {
    ans = ((ans < sum + b1[i] - r[i]) ? ans : sum + b1[i] - r[i]);
    if (a[0].second == i)
      ans = ((ans < sum + b1[i] - r[i] + a[1].first)
                 ? ans
                 : sum + b1[i] - r[i] + a[1].first);
    else
      ans = ((ans < sum + b1[i] - r[i] + a[0].first)
                 ? ans
                 : sum + b1[i] - r[i] + a[0].first);
  }
  cout << ans << "\n";
  return 0;
}
