#include <bits/stdc++.h>
using namespace std;
const int N = 100100;
const long long INF = 1100000000000000000L;
int n, ax[3], ay[3], x[N], y[N], tx, ty;
double sqr(long long x) { return x * x; }
double dst(int x, int y, int a, int b) { return sqrt(sqr(x - a) + sqr(y - b)); }
double get(int f, int s) {
  double mx = -INF, idx, id = -1;
  for (int i = 1; i <= n; i++) {
    double a = dst(ax[f], ay[f], x[i], y[i]) + dst(x[i], y[i], tx, ty);
    double b = dst(x[i], y[i], tx, ty) * 2;
    if (b - a > mx) {
      mx = b - a;
      idx = i;
    }
  }
  mx = 0;
  for (int i = 1; i <= n; i++)
    if (i != idx) {
      double a = dst(ax[s], ay[s], x[i], y[i]) + dst(x[i], y[i], tx, ty);
      double b = dst(x[i], y[i], tx, ty) * 2;
      if (b - a > mx) {
        mx = b - a;
        id = i;
      }
    }
  double res = 0;
  for (int i = 1; i <= n; i++) {
    if (i == idx)
      res += dst(ax[f], ay[f], x[i], y[i]) + dst(x[i], y[i], tx, ty);
    else if (i == id)
      res += dst(ax[s], ay[s], x[i], y[i]) + dst(x[i], y[i], tx, ty);
    else
      res += dst(x[i], y[i], tx, ty) * 2;
  }
  return res;
}
int main() {
  cin >> ax[1] >> ay[1] >> ax[2] >> ay[2] >> tx >> ty;
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d%d", &x[i], &y[i]);
  double res = min(get(1, 2), get(2, 1));
  printf("%.13f", res);
}
