#include <bits/stdc++.h>
using namespace std;
double a, ay, b, by, dx, dy, x[100011], y[100011], before[100011],
    after[100011], r = 1e18, dist;
int n, i, pos;
int main() {
  cin >> a >> ay >> b >> by >> dx >> dy >> n;
  for (i = 1; i <= n; i++) {
    cin >> x[i] >> y[i];
    dist += 2 * sqrt((dx - x[i]) * (dx - x[i]) + (dy - y[i]) * (dy - y[i]));
  }
  for (i = 1; i <= n; i++)
    r = min(r, dist +
                   sqrt((a - x[i]) * (a - x[i]) + (ay - y[i]) * (ay - y[i])) -
                   sqrt((dx - x[i]) * (dx - x[i]) + (dy - y[i]) * (dy - y[i])));
  for (i = 1; i <= n; i++)
    r = min(r, dist +
                   sqrt((b - x[i]) * (b - x[i]) + (by - y[i]) * (by - y[i])) -
                   sqrt((dx - x[i]) * (dx - x[i]) + (dy - y[i]) * (dy - y[i])));
  for (i = 1; i <= n; i++)
    before[i] = after[i] =
        sqrt((b - x[i]) * (b - x[i]) + (by - y[i]) * (by - y[i])) -
        sqrt((dx - x[i]) * (dx - x[i]) + (dy - y[i]) * (dy - y[i]));
  for (i = 2; i <= n; ++i) before[i] = min(before[i], before[i - 1]);
  for (i = n - 1; i >= 1; --i) after[i] = min(after[i], after[i + 1]);
  before[0] = after[n + 1] = 1e18;
  for (i = 1; i <= n; ++i)
    r = min(r, dist +
                   sqrt((a - x[i]) * (a - x[i]) + (ay - y[i]) * (ay - y[i])) -
                   sqrt((dx - x[i]) * (dx - x[i]) + (dy - y[i]) * (dy - y[i])) +
                   min(before[i - 1], after[i + 1]));
  cout.precision(15);
  cout << r;
  return 0;
}
