#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
pair<long double, long double> a[N];
long double two(long double n) { return n * n; }
inline long double dist(int i, int j) {
  return sqrt(two(a[i].first - a[j].first) + two(a[i].second - a[j].second));
}
int n;
vector<pair<long double, long double> > v[2];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  vector<pair<long double, long double> > r(3);
  for (int i = 0; i < 3; i++) cin >> r[i].first >> r[i].second;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i].first >> a[i].second;
  for (int i = n; i < n + 3; i++) a[i] = r[i - n];
  long double ans = 1e18;
  if (n == 1) {
    ans = dist(n, 0) + dist(0, n + 2);
    ans = min(ans, dist(n + 1, 0) + dist(0, n + 2));
    cout << fixed << setprecision(7) << ans << endl;
    return 0;
  }
  v[0].resize(3), v[1].resize(3);
  for (int i = 0; i < 3; i++) v[0][i] = v[1][i] = make_pair(-1e18, -1e18);
  long double total = 0;
  for (int i = 0; i < n; i++) {
    v[0][2] =
        make_pair(2.0 * dist(n + 2, i) - (dist(n, i) + dist(i, n + 2)), i);
    v[1][2] =
        make_pair(2.0 * dist(n + 2, i) - (dist(n + 1, i) + dist(i, n + 2)), i);
    total += 2.0 * dist(n + 2, i);
    sort(v[1].rbegin(), v[1].rend());
    sort(v[0].rbegin(), v[0].rend());
  }
  ans = min(ans, total - v[0][0].first);
  ans = min(ans, total - v[1][0].first);
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      if (v[0][i].second == v[1][j].second) continue;
      ans = min(ans, total - (v[0][i].first + v[1][j].first));
    }
  }
  cout << fixed << setprecision(7) << ans << endl;
  return 0;
}
