#include <bits/stdc++.h>
const long long mod = 1000000007;
using namespace std;
int main() {
  long long ax, ay, bx, by, tx, ty;
  scanf("%I64d", &(ax));
  scanf("%I64d", &(ay));
  scanf("%I64d", &(bx));
  scanf("%I64d", &(by));
  scanf("%I64d", &(tx));
  scanf("%I64d", &(ty));
  long long n;
  scanf("%I64d", &(n));
  vector<pair<long long, long long>> bot(n);
  vector<double> toT(n);
  vector<pair<double, int>> toA(n), toB(n);
  double sum = 0;
  for (int(i) = 0; (i) < n; (i)++) {
    scanf("%I64d", &(bot[i].first));
    scanf("%I64d", &(bot[i].second));
    toT[i] = sqrt((double)((bot[i].first - tx) * (bot[i].first - tx) +
                           (bot[i].second - ty) * (bot[i].second - ty)));
    sum += 2 * toT[i];
    toA[i].first = sqrt((double)((bot[i].first - ax) * (bot[i].first - ax) +
                                 (bot[i].second - ay) * (bot[i].second - ay)));
    toA[i].first -= toT[i];
    toA[i].second = i;
    toB[i].first = sqrt((double)((bot[i].first - bx) * (bot[i].first - bx) +
                                 (bot[i].second - by) * (bot[i].second - by)));
    toB[i].first -= toT[i];
    toB[i].second = i;
  }
  sort((toA).begin(), (toA).end());
  sort((toB).begin(), (toB).end());
  double ans = 1e18;
  for (int i = 0; i < n; i++) {
    int j = toA[i].second;
    int k = toB[0].second;
    double tmp = sum + toA[i].first;
    ans = min(ans, tmp);
    tmp = sum + toB[i].first;
    ans = min(ans, tmp);
    if (j != k)
      tmp = sum + toA[i].first + toB[0].first;
    else
      tmp = sum + toA[i].first + toB[1].first;
    j = toB[i].second;
    ans = min(ans, tmp);
    k = toA[0].second;
    if (j != k)
      tmp = sum + toA[0].first + toB[i].first;
    else
      tmp = sum + toA[1].first + toB[i].first;
    ans = min(ans, tmp);
  }
  printf("%.10f", ans);
  return 0;
}
