#include <bits/stdc++.h>
using namespace std;
pair<double, double> p[100100];
double dt[100100];
double db[100100];
double da[100100];
int main() {
  double ax, ay, bx, by, tx, ty;
  int n;
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  cin >> n;
  double ans = 0;
  scanf("%lf %lf", &p[0].first, &p[0].second);
  ans += sqrt((p[0].first - tx) * (p[0].first - tx) +
              (p[0].second - ty) * (p[0].second - ty));
  dt[0] = ans;
  for (int i = 1; i < n; i++) {
    scanf("%lf %lf", &p[i].first, &p[i].second);
    dt[i] = sqrt((p[i].first - tx) * (p[i].first - tx) +
                 (p[i].second - ty) * (p[i].second - ty));
    ans += dt[i];
  }
  ans *= 2;
  for (int i = 0; i < n; i++) {
    da[i] = sqrt((p[i].first - ax) * (p[i].first - ax) +
                 (p[i].second - ay) * (p[i].second - ay));
    db[i] = sqrt((p[i].first - bx) * (p[i].first - bx) +
                 (p[i].second - by) * (p[i].second - by));
  }
  double p1, p2, p3, p4;
  double Da = 1.7976931348623158e+308, Db = 1.7976931348623158e+308;
  int indexofa = -1;
  int indexofb = -1;
  for (int i = 0; i < n; i++) {
    if (da[i] - dt[i] < Da) {
      Da = da[i] - dt[i];
      indexofa = i;
    }
  }
  for (int i = 0; i < n; i++) {
    if (db[i] - dt[i] < Db && i != indexofa) {
      Db = db[i] - dt[i];
      indexofb = i;
    }
  }
  p1 = Da + Db;
  Da = 1.7976931348623158e+308, Db = 1.7976931348623158e+308;
  indexofa = -1;
  indexofb = -1;
  for (int i = 0; i < n; i++) {
    if (db[i] - dt[i] < Db) {
      Db = db[i] - dt[i];
      indexofb = i;
    }
  }
  for (int i = 0; i < n; i++) {
    if (da[i] - dt[i] < Da && i != indexofb) {
      Da = da[i] - dt[i];
      indexofa = i;
    }
  }
  p2 = Da + Db;
  Db = 1.7976931348623158e+308;
  indexofb = -1;
  for (int i = 0; i < n; i++) {
    if (db[i] - dt[i] < Db) {
      Db = db[i] - dt[i];
      indexofb = i;
    }
  }
  p3 = Db;
  Da = 1.7976931348623158e+308;
  indexofa = -1;
  for (int i = 0; i < n; i++) {
    if (da[i] - dt[i] < Da) {
      Da = da[i] - dt[i];
      indexofa = i;
    }
  }
  p4 = Da;
  printf("%.12lf", min(min(p1, p2), min(p3, p4)) + ans);
  return 0;
}
