#include <bits/stdc++.h>
using namespace std;
double distance(int x, int y, int a, int b) {
  long double d1 = x - a;
  d1 *= d1;
  long double d2 = y - b;
  d2 *= d2;
  long double d = d1 + d2;
  return sqrt(d);
}
int main() {
  int ax, ay, bx, by, tx, ty;
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  int n;
  cin >> n;
  int x[n], y[n];
  for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
  double d = 0;
  for (int i = 0; i < n; i++) {
    d += 2 * distance(x[i], y[i], tx, ty);
  }
  double dd = d;
  double da = d;
  double db = d;
  int inda = 0;
  double tmp = 0, t1, t2, dis = numeric_limits<double>::max();
  for (int i = 0; i < n; i++) {
    t1 = distance(x[i], y[i], ax, ay);
    t2 = distance(x[i], y[i], tx, ty);
    tmp = t1 - t2;
    if (tmp < dis) {
      dis = tmp;
      inda = i;
    }
  }
  d += dis;
  double damin = dis;
  int indb = 0;
  dis = numeric_limits<double>::max();
  for (int i = 0; i < n; i++) {
    if (i == inda) continue;
    tmp = distance(x[i], y[i], bx, by) - distance(x[i], y[i], tx, ty);
    if (tmp < dis) {
      dis = tmp;
      indb = i;
    }
  }
  d += dis;
  indb = 0;
  dis = numeric_limits<double>::max();
  for (int i = 0; i < n; i++) {
    tmp = distance(x[i], y[i], bx, by) - distance(x[i], y[i], tx, ty);
    if (tmp < dis) {
      dis = tmp;
      indb = i;
    }
  }
  dd += dis;
  double dbmin = dis;
  inda = 0;
  tmp = 0, dis = numeric_limits<double>::max();
  for (int i = 0; i < n; i++) {
    if (i == indb) continue;
    tmp = distance(x[i], y[i], ax, ay) - distance(x[i], y[i], tx, ty);
    if (tmp < dis) {
      dis = tmp;
      inda = i;
    }
  }
  dd += dis;
  double dmin = min(da + damin, db + dbmin);
  printf("%.10lf", min(min(d, dd), dmin));
  return 0;
}
