#include <bits/stdc++.h>
using namespace std;
long double x[100005], y[100005];
long double da[100005], db[100005], dt[100005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  long double ax, ay, bx, by, tx, ty;
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
  long double tot = 0;
  for (int i = 0; i < n; i++) {
    da[i] = (long double)sqrt(
        (long double)((x[i] - ax) * (x[i] - ax) + (y[i] - ay) * (y[i] - ay)));
    db[i] = (double)sqrt(
        (long double)((x[i] - bx) * (x[i] - bx) + (y[i] - by) * (y[i] - by)));
    dt[i] = (long double)sqrt(
        (long double)((x[i] - tx) * (x[i] - tx) + (y[i] - ty) * (y[i] - ty)));
    tot += 2 * dt[i];
  }
  int ia = 0, ib = 0;
  long double mna = 100000000000000000.00, mnb = 100000000000000000.000, kon;
  for (int i = 0; i < n; i++) {
    if (mna > (tot - dt[i] + da[i])) {
      ia = i;
      mna = tot - dt[i] + da[i];
    }
    if (mnb > (tot - dt[i] + db[i])) {
      ib = i;
      mnb = tot - dt[i] + db[i];
    }
  }
  kon = mna;
  for (int i = 0; i < n; i++) {
    if (i != ia && mna > kon - dt[i] + db[i]) mna = kon - dt[i] + db[i];
  }
  kon = mnb;
  for (int i = 0; i < n; i++) {
    if (i != ib && mnb > kon - dt[i] + da[i]) mnb = kon - dt[i] + da[i];
  }
  cout << std::setprecision(20) << min(mna, mnb) << endl;
  return 0;
}
