#include <bits/stdc++.h>
using namespace std;
long double ooo = 10000000000000000.0;
int ax, ay, bx, by;
int n;
int tx, ty;
int x[100008], y[100008];
long double dist[100008], disa[100008], disb[100008];
long double memo[100008][4];
long double go(int id, int st) {
  if (id >= n)
    if (st == 0)
      return ooo;
    else
      return 0;
  if (memo[id][st] >= 0) return memo[id][st];
  long double ret = 0;
  if (st == 0) {
    ret = dist[id] * 2 + go(id + 1, 0);
    ret = min(ret, dist[id] + disa[id] + go(id + 1, 1));
    ret = min(ret, dist[id] + disb[id] + go(id + 1, 2));
  } else if (st == 1) {
    ret = dist[id] * 2 + go(id + 1, 1);
    ret = min(ret, dist[id] + disb[id] + go(id + 1, 3));
  } else if (st == 2) {
    ret = dist[id] * 2 + go(id + 1, 2);
    ret = min(ret, dist[id] + disa[id] + go(id + 1, 3));
  } else
    ret = dist[id] * 2 + go(id + 1, st);
  return memo[id][st] = ret;
}
int main() {
  scanf("%d%d%d%d%d%d", &ax, &ay, &bx, &by, &tx, &ty);
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &x[i], &y[i]);
  }
  for (int i = 0; i < n + 1; i++)
    for (int j = 0; j < 4; j++) memo[i][j] = -1.0;
  for (int i = 0; i < n; i++) {
    dist[i] = (long double)hypot(tx - x[i], ty - y[i]);
    disa[i] = (long double)hypot(ax - x[i], ay - y[i]);
    disb[i] = (long double)hypot(bx - x[i], by - y[i]);
  }
  long double ans = go(0, 0);
  cout << setprecision(24) << ans << endl;
}
