#include <bits/stdc++.h>
using namespace std;
struct P {
  double x, y;
  P(double _x = 0, double _y = 0) : x(_x), y(_y) {}
} p[110000];
double X1, Y1, X2, Y2, xs, ys, ans, sum;
int n, id1[110000], id2[110000];
double rt[110000], to1[110000], to2[110000];
inline bool cmp1(int a, int b) { return to1[a] > to1[b]; }
inline bool cmp2(int a, int b) { return to2[a] > to2[b]; }
void Up(double &ans, int a, int b) {
  double A = to1[a], B = to2[b];
  if (ans == 0.0) ans = sum - B - A;
  ans = min(ans, sum - B - A);
}
double Dist(double x1, double y1, double x2, double y2) {
  return sqrt((y1 - y2) * (y1 - y2) + (x1 - x2) * (x1 - x2));
}
int main() {
  scanf("%lf%lf%lf%lf%lf%lf", &X1, &Y1, &X2, &Y2, &xs, &ys);
  cin >> n;
  double x, y;
  for (int i = 1; i <= n; i++) {
    scanf("%lf%lf", &x, &y);
    p[i] = P(x, y);
    rt[i] = Dist(x, y, xs, ys);
    to1[i] = Dist(x, y, X1, Y1);
    to2[i] = Dist(x, y, X2, Y2);
    to1[i] = rt[i] - to1[i];
    to2[i] = rt[i] - to2[i];
    id1[i] = i;
    id2[i] = i;
    sum += rt[i] * 2;
  }
  ans = 0.0;
  sort(id1 + 1, id1 + 1 + n, cmp1);
  sort(id2 + 1, id2 + 1 + n, cmp2);
  int amx = id1[1], amx2 = id1[2];
  int bmx = id2[1], bmx2 = id2[2];
  Up(ans, amx, 0);
  Up(ans, 0, bmx);
  if (amx != bmx)
    Up(ans, amx, bmx);
  else
    Up(ans, amx2, bmx), Up(ans, amx, bmx2);
  printf("%.12lf", ans);
  return 0;
}
