#include <bits/stdc++.h>
using namespace std;
long double mn, ax, ay, bx, by, tx, ty, x[111111], y[111111], b[111111][2][2];
int n, i;
long double p(long double x, long double y, long double x2, long double y2) {
  return sqrt((x - x2) * (x - x2) + (y - y2) * (y - y2));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> ax >> ay >> bx >> by >> tx >> ty >> n;
  for (i = 0; i < n; i++) cin >> x[i] >> y[i];
  b[0][0][0] = 2 * p(tx, ty, x[0], y[0]);
  b[0][1][0] = p(x[0], y[0], ax, ay) + p(tx, ty, x[0], y[0]);
  b[0][0][1] = p(x[0], y[0], bx, by) + p(tx, ty, x[0], y[0]);
  for (i = 1; i < n; i++) {
    b[i][0][0] = b[i - 1][0][0] + 2 * p(tx, ty, x[i], y[i]);
    b[i][1][0] =
        min(b[i - 1][0][0] + p(x[i], y[i], ax, ay) + p(tx, ty, x[i], y[i]),
            b[i - 1][1][0] + 2 * p(tx, ty, x[i], y[i]));
    b[i][0][1] =
        min(b[i - 1][0][0] + p(x[i], y[i], bx, by) + p(tx, ty, x[i], y[i]),
            b[i - 1][0][1] + 2 * p(tx, ty, x[i], y[i]));
    if (b[i - 1][1][1])
      b[i][1][1] = min(
          min(b[i - 1][1][0] + p(x[i], y[i], bx, by) + p(tx, ty, x[i], y[i]),
              b[i - 1][0][1] + p(x[i], y[i], ax, ay) + p(tx, ty, x[i], y[i])),
          b[i - 1][1][1] + 2 * p(tx, ty, x[i], y[i]));
    else
      b[i][1][1] =
          min(b[i - 1][1][0] + p(x[i], y[i], bx, by) + p(tx, ty, x[i], y[i]),
              b[i - 1][0][1] + p(x[i], y[i], ax, ay) + p(tx, ty, x[i], y[i]));
  }
  if (b[n - 1][1][1])
    mn = min(b[n - 1][1][0], min(b[n - 1][1][1], b[n - 1][0][1]));
  else
    mn = min(b[n - 1][1][0], b[n - 1][0][1]);
  cout << fixed << setprecision(6) << mn;
  return 0;
}
