#include <bits/stdc++.h>
using namespace std;
int ax, ay, bx, by, tx, ty;
vector<int> vx, vy;
vector<double> disa, disb;
double cal(int& px, int& py, int& tx, int& ty) {
  double x1 = (double)px, y1 = (double)py;
  double x2 = (double)tx, y2 = (double)ty;
  return sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}
int main() {
  ios::sync_with_stdio(0);
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  int n, px, py;
  double da, db, dt, sumdis = 0, mina = 999999999, minb = 999999999;
  int ai, bi;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> px >> py;
    vx.push_back(px);
    vy.push_back(py);
    da = cal(px, py, ax, ay);
    db = cal(px, py, bx, by);
    dt = cal(px, py, tx, ty);
    if (da - dt < mina) {
      mina = da - dt;
      ai = i;
    }
    if (db - dt < minb) {
      minb = db - dt;
      bi = i;
    }
    disa.push_back(da - dt);
    disb.push_back(db - dt);
    sumdis += 2.0 * dt;
  }
  sort(disa.begin(), disa.end());
  sort(disb.begin(), disb.end());
  cout.setf(ios::fixed);
  if (n == 1) {
    cout << setprecision(7) << min(sumdis + disa[0], sumdis + disb[0]) << endl;
  } else {
    if (ai != bi) {
      if (disa[0] > 0 || disb[0] > 0) {
        if (disa[0] > disb[0])
          disa[0] = 0;
        else
          disb[0] = 0;
      }
      cout << setprecision(7) << sumdis + disa[0] + disb[0] << endl;
    } else {
      double ans1, ans2;
      if (disa[0] > 0 || disb[1] > 0) {
        if (disa[0] > disb[1])
          disa[0] = 0;
        else
          disb[1] = 0;
      }
      ans1 = sumdis + disa[0] + disb[1];
      if (disa[1] > 0 || disb[0] > 0) {
        if (disa[1] > disb[0])
          disa[1] = 0;
        else
          disb[0] = 0;
      }
      ans2 = sumdis + disa[1] + disb[0];
      cout << setprecision(7) << min(ans1, ans2) << endl;
    }
  }
  return 0;
}
