#include <bits/stdc++.h>
using namespace std;
long double ax, ay, bx, by, tx, ty, da, db, dt, mn, mn1, mn2, mna1, mna2, ans1,
    x[1000000], y[1000000], ans, INF = 100000000000000;
int n, opt1, opt2, opta1, opta2;
long double dist(long double x1, long double y1, long double x2,
                 long double y2) {
  return sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}
int main() {
  std::ios_base::sync_with_stdio(false);
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    dt = dist(x[i], y[i], tx, ty);
    ans += 2 * dt;
  }
  mn1 = mn2 = mna1 = mna2 = INF;
  for (int i = 0; i < n; i++) {
    db = dist(x[i], y[i], bx, by);
    dt = dist(x[i], y[i], tx, ty);
    da = dist(x[i], y[i], ax, ay);
    if (db - dt <= mn1) {
      opt2 = opt1;
      mn2 = mn1;
      opt1 = i;
      mn1 = db - dt;
    } else if (db - dt <= mn2) {
      opt2 = i;
      mn2 = db - dt;
    }
    if (da - dt <= mna1) {
      opta2 = opta1;
      mna2 = mna1;
      opta1 = i;
      mna1 = da - dt;
    } else if (db - dt <= mna2) {
      opta2 = i;
      mna2 = da - dt;
    }
  }
  if (opta1 != opt1)
    ans1 = mn1 + mna1;
  else
    ans1 = min(mn1 + mna2, mn2 + mna1);
  cout << setprecision(15) << ans + min(ans1, min(mn1, mna1)) << endl;
  ;
  return 0;
}
