#include <bits/stdc++.h>
using namespace std;
int main() {
  pair<double, double> a, b, t;
  int n;
  cin >> a.first >> a.second;
  cin >> b.first >> b.second;
  cin >> t.first >> t.second;
  cin >> n;
  vector<pair<double, double>> d(n);
  for (int i = 0; i < n; i++) cin >> d[i].first >> d[i].second;
  vector<double> e(n);
  vector<pair<double, int>> c(n), g(n);
  for (int i = 0; i < n; i++) {
    e[i] = sqrt(pow(d[i].first - t.first, 2) + pow(d[i].second - t.second, 2));
    c[i].first =
        sqrt(pow(d[i].first - a.first, 2) + pow(d[i].second - a.second, 2)) -
        e[i];
    c[i].second = i;
    g[i].first =
        sqrt(pow(d[i].first - b.first, 2) + pow(d[i].second - b.second, 2)) -
        e[i];
    g[i].second = i;
  }
  sort(c.begin(), c.end());
  sort(g.begin(), g.end());
  double r;
  if (c[0].second != g[0].second)
    r = c[0].first + g[0].first;
  else {
    if (c[0].first + g[1].first > c[1].first + g[0].first)
      r = c[1].first + g[0].first;
    else
      r = c[0].first + g[1].first;
  }
  double ans = 0, out;
  for (int i = 0; i < n; i++) ans += e[i];
  ans = 2 * ans;
  out = ans + g[0].first;
  ans = min(ans + r, ans + c[0].first);
  out = min(out, ans);
  cout << fixed << out;
  return 0;
}
