#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const long long int INF = 9e18 + 2e17;
const int inf = 2e9;
const double eps = 1e-10;
long long int get_dis(vector<pair<int, int> >& pos, int idx, int tx, int ty) {
  int d1 = pos[idx].first - tx;
  int d2 = pos[idx].second - ty;
  return 1ll * d1 * d1 + 1ll * d2 * d2;
}
int main(int argc, char const* argv[]) {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int ax, ay, bx, by, tx, ty;
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  int n;
  cin >> n;
  vector<pair<int, int> > pos(n);
  for (int i = (int)0; i < (int)n; i++) cin >> pos[i].first >> pos[i].second;
  std::vector<double> ladki(n);
  std::vector<double> ladka(n);
  long double tot = 0;
  for (int i = (int)0; i < (int)n; i++) {
    ladka[i] = sqrt(get_dis(pos, i, ax, ay)) - sqrt(get_dis(pos, i, tx, ty));
    ladki[i] = sqrt(get_dis(pos, i, bx, by)) - sqrt(get_dis(pos, i, tx, ty));
    tot += 2 * (long double)sqrt(get_dis(pos, i, tx, ty));
  }
  int idx = 0;
  long double curr = tot + ladka[0];
  for (int i = (int)0; i < (int)n; i++) {
    if (tot + ladka[i] < curr) {
      curr = tot + ladka[i];
      idx = i;
    }
  }
  long double ans = curr;
  for (int i = (int)0; i < (int)n; i++) {
    if (idx == i) continue;
    if (curr + ladki[i] < ans) {
      ans = curr + ladki[i];
    }
  }
  int idx2 = 0;
  long double curr2 = tot + ladki[0];
  for (int i = (int)0; i < (int)n; i++) {
    if (tot + ladki[i] < curr2) {
      curr2 = tot + ladki[i];
      idx2 = i;
    }
  }
  long double ans2 = curr2;
  for (int i = (int)0; i < (int)n; i++) {
    if (idx2 == i) continue;
    if (curr2 + ladka[i] < ans) {
      ans = curr2 + ladka[i];
    }
  }
  ans = min(ans, ans2);
  cout << setprecision(20) << fixed << ans << endl;
  return 0;
}
