#include <bits/stdc++.h>
using namespace std;
double dis1[100002];
double dis2[100002];
double eps = 2e-9;
int main() {
  int ax, ay, bx, by, tx, ty;
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  int n;
  cin >> n;
  int x, y;
  long double sum = 0;
  double m = 0;
  double m1, m2;
  int id1, id2;
  m1 = m2 = 2e9 + 20;
  for (int i = 0; i < n; ++i) {
    cin >> x >> y;
    m = hypot(x - tx, y - ty);
    sum += m;
    dis1[i] = hypot(x - ax, y - ay) - m;
    if (m1 > dis1[i]) id1 = i, m1 = dis1[i];
    dis2[i] = hypot(x - bx, y - by) - m;
    if (m2 > dis2[i]) id2 = i, m2 = dis2[i];
  }
  long double ans =
      sum * 2 + min(hypot(ax - tx, ay - ty), hypot(bx - tx, by - ty));
  for (int i = 0; i < n; ++i) {
    if (i == id1) {
      ans = min(ans, sum * 2 + dis1[i]);
      continue;
    }
    ans = min(ans, sum * 2 + dis1[id1] + dis2[i]);
  }
  for (int i = 0; i < n; ++i) {
    if (i == id2) {
      ans = min(ans, sum * 2 + dis2[i]);
      continue;
    }
    ans = min(ans, sum * 2 + dis1[i] + dis2[id2]);
  }
  printf("%.08LF\n", ans);
}
