#include <bits/stdc++.h>
using namespace std;
struct node {
  int id;
  double len;
  double diff;
};
bool cmp(node a, node b) { return a.diff <= b.diff; }
int main() {
  double ax, ay, bx, by, tx, ty;
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  int n;
  cin >> n;
  node alist[n];
  node blist[n];
  double x[n];
  double y[n];
  double len[n];
  double all = 0;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    len[i] = sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
    all += (2.0 * len[i]);
    alist[i].id = i;
    blist[i].id = i;
    alist[i].len = sqrt((ax - x[i]) * (ax - x[i]) + (ay - y[i]) * (ay - y[i]));
    alist[i].diff = alist[i].len - len[i];
    blist[i].len = sqrt((bx - x[i]) * (bx - x[i]) + (by - y[i]) * (by - y[i]));
    blist[i].diff = blist[i].len - len[i];
  }
  double b = all - len[0] +
             sqrt((x[0] - bx) * (x[0] - bx) + (y[0] - by) * (y[0] - by));
  double a = all - len[0] +
             sqrt((x[0] - ax) * (x[0] - ax) + (y[0] - ay) * (y[0] - ay));
  double temp;
  for (int i = 1; i < n; i++) {
    temp = all - len[i] +
           sqrt((x[i] - ax) * (x[i] - ax) + (y[i] - ay) * (y[i] - ay));
    if (temp < a) {
      a = temp;
    }
    temp = all - len[i] +
           sqrt((x[i] - bx) * (x[i] - bx) + (y[i] - by) * (y[i] - by));
    if (temp < b) {
      b = temp;
    }
  }
  double ab;
  sort(alist, alist + n, cmp);
  sort(blist, blist + n, cmp);
  if (alist[0].id == blist[0].id) {
    ab = all + alist[0].diff + blist[1].diff;
    temp = all + alist[1].diff + blist[0].diff;
    ab = min(ab, temp);
  } else {
    ab = all + alist[0].diff + blist[0].diff;
  }
  a = min(a, b);
  printf("%.8lf\n", min(a, ab));
  return 0;
}
