#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
const int SIZ_TREE = 3e5 + 10;
long double ans = 0;
int n;
long double ax, ay, bx, by, tx, ty;
long double xi[N], yi[N];
long double dis[2][10];
int p[2][10], cnt[2];
void init() {
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  cin >> n;
  double x, y;
  for (int i = 1; i <= n; i++) {
    scanf("%lf%lf", &x, &y);
    xi[i] = x, yi[i] = y;
  }
}
long double dist(long double a, long double b, long double c, long double d) {
  return sqrt(((c - a) * (c - a)) + ((b - d) * (b - d)));
}
void print(long double a) {
  double A = a;
  printf("%.10f\n", A);
}
void work() {
  if (n == 1) {
    ans = min(dist(xi[1], yi[1], ax, ay), dist(xi[1], yi[1], bx, by)) +
          dist(xi[1], yi[1], tx, ty);
    print(ans);
    return;
  }
  long double d;
  for (int k = 0; k <= 1; k++)
    for (int i = 1; i <= n; i++) {
      if (k == 0)
        d = dist(xi[i], yi[i], ax, ay) - dist(xi[i], yi[i], tx, ty);
      else
        d = dist(xi[i], yi[i], bx, by) - dist(xi[i], yi[i], tx, ty),
        ans += dist(xi[i], yi[i], tx, ty) * 2.0;
      if (cnt[k] == 0) {
        cnt[k]++;
        p[k][1] = i;
        dis[k][1] = d;
      } else if (cnt[k] == 1) {
        cnt[k]++;
        p[k][2] = i;
        dis[k][2] = d;
        if (dis[k][2] < dis[k][1]) {
          swap(dis[k][2], dis[k][1]);
          swap(p[k][2], p[k][1]);
        }
      } else if (cnt[k] == 2) {
        if (dis[k][1] > d) {
          dis[k][2] = dis[k][1];
          p[k][2] = p[k][1];
          dis[k][1] = d;
          p[k][1] = i;
        } else if (dis[k][2] > d) {
          dis[k][2] = d;
          p[k][2] = i;
        }
      }
    }
  long double tot = ans;
  ans = tot + min(dis[0][1], dis[1][1]);
  for (int i = 1; i <= cnt[0]; i++)
    for (int j = 1; j <= cnt[1]; j++)
      if (p[0][i] != p[1][j]) {
        ans = min(ans, tot + dis[0][i] + dis[1][j]);
      }
  print(ans);
}
int main() {
  init();
  work();
  return 0;
}
