#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 5;
const int nax = 1e6 + 5;
struct P {
  int x, y;
  void read() { scanf("%d%d", &x, &y); }
};
long double dist(P a, P b) {
  return sqrt(pow(a.x - b.x, 2) + pow(a.y - b.y, 2));
}
P t[nax];
long double answer = -1;
void consider(long double x) {
  if (answer < -0.5 || x < answer) answer = x;
}
int main() {
  P A, B, T;
  A.read();
  B.read();
  T.read();
  int n;
  scanf("%d", &n);
  long double total = 0;
  for (int i = (0); i <= ((n)-1); ++i) {
    t[i].read();
    total += 2 * dist(T, t[i]);
  }
  for (int _ = (0); _ <= ((2) - 1); ++_) {
    long double best_save = 0;
    for (int i = 0; i < n; ++i) {
      consider(total - dist(T, t[i]) + dist(A, t[i]));
      consider(total - dist(T, t[i]) + dist(B, t[i]) - best_save);
      best_save = max(best_save, dist(T, t[i]) - dist(A, t[i]));
    }
    swap(A, B);
  }
  printf("%.10lf\n", (double)answer);
  return 0;
}
