#include <bits/stdc++.h>
using namespace std;
pair<long double, long double> B[100005];
pair<long double, long double> dist1[100005];
pair<long double, long double> dist2[100005];
pair<long double, long double> dist3[100005];
int main() {
  long double a1, a2, b1, b2, t1, t2;
  int n;
  cin >> a1 >> a2 >> b1 >> b2 >> t1 >> t2;
  cin >> n;
  long double totalDist = 0;
  for (int i = 0; i < n; ++i) {
    cin >> B[i].first >> B[i].second;
    dist1[i] = make_pair(sqrt((B[i].first - t1) * (B[i].first - t1) +
                              (B[i].second - t2) * (B[i].second - t2)),
                         i);
    totalDist += dist1[i].first;
    dist2[i] = make_pair(sqrt((B[i].first - a1) * (B[i].first - a1) +
                              (B[i].second - a2) * (B[i].second - a2)) -
                             dist1[i].first,
                         i);
    dist3[i] = make_pair(sqrt((B[i].first - b1) * (B[i].first - b1) +
                              (B[i].second - b2) * (B[i].second - b2)) -
                             dist1[i].first,
                         i);
  }
  sort(dist2, dist2 + n);
  sort(dist3, dist3 + n);
  if (n == 1) {
    long double ans = 0;
    ans = 2 * totalDist + min(dist2[0].first, dist3[0].first);
    printf("%.9lf\n", double(ans));
    return 0;
  }
  long double f;
  if (dist2[0].second != dist3[0].second) {
    f = min(dist2[0].first,
            min(dist2[0].first + dist3[0].first, dist3[0].first));
  } else {
    f = min(
        min(dist2[0].first, dist3[0].first),
        min(dist2[1].first + dist3[0].first, dist2[0].first + dist3[1].first));
  }
  long double Dist = 2 * totalDist + f;
  printf("%.9lf\n", double(Dist));
  return 0;
}
