#include <bits/stdc++.h>
using namespace std;
struct blk {
  int x, y;
  double d;
};
double mt(double a, double b) {
  if (a > b) {
    return b;
  } else
    return a;
}
int main() {
  int i, x1, x2, y1, y2, x, y;
  cin >> x1 >> y1 >> x2 >> y2 >> x >> y;
  int n;
  cin >> n;
  blk pt[n];
  double sum = 0;
  for (i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    pt[i].x = a;
    pt[i].y = b;
    pt[i].d = sqrt((long long)(x - a) * (x - a) + (long long)(y - b) * (y - b));
    sum += (2.0 * pt[i].d);
  }
  double ad[n], be[n], mina = 1e12 + 1, minb = 1e12 + 1, m1 = 1e12 + 1,
                       m2 = 1e12 + 1;
  int op1, op2, pos, p2;
  for (i = 0; i < n; i++) {
    ad[i] = sqrt((long long)(x1 - pt[i].x) * (x1 - pt[i].x) +
                 (long long)(y1 - pt[i].y) * (y1 - pt[i].y)) -
            pt[i].d;
    be[i] = sqrt((long long)(x2 - pt[i].x) * (x2 - pt[i].x) +
                 (long long)(y2 - pt[i].y) * (y2 - pt[i].y)) -
            pt[i].d;
    if (minb > be[i]) {
      m2 = minb;
      minb = be[i];
      op2 = op1;
      op1 = i;
    } else if (m2 > be[i]) {
      m2 = be[i];
      op2 = i;
    }
    if (mina > ad[i]) {
      m1 = mina;
      mina = ad[i];
      p2 = pos;
      pos = i;
    } else if (m1 > ad[i]) {
      m1 = ad[i];
      p2 = i;
    }
  }
  if (op1 != pos) {
    sum = mt(mt(sum + mina + minb, sum + mina), sum + minb);
  } else {
    if (mina + m2 < minb + m1) {
      sum = mt(mt(sum + mina + m2, sum + mina), sum + minb);
    } else
      sum = mt(mt(sum + minb + m1, sum + mina), sum + minb);
  }
  printf("%0.12lf\n", sum);
  return 0;
}
