#include <bits/stdc++.h>
using namespace std;
double const INF = 1e30;
int const MAX = 1e5 + 5;
struct POINT {
  double x, y;
} p[MAX], a, b, t;
bool vis[MAX];
double dis[MAX];
int n;
double cal_d(POINT a, POINT b) {
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
double get_val(POINT st) {
  double tmp = -INF, res = 0;
  int pos = 0;
  for (int i = 0; i < n; i++) {
    double dif = dis[i] - cal_d(st, p[i]);
    if (!vis[i] && dif >= tmp) {
      res = cal_d(st, p[i]);
      tmp = dif;
      pos = i;
    }
  }
  vis[pos] = true;
  return res;
}
int main() {
  scanf("%lf %lf %lf %lf %lf %lf", &a.x, &a.y, &b.x, &b.y, &t.x, &t.y);
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%lf %lf", &p[i].x, &p[i].y);
  for (int i = 0; i < n; i++) dis[i] = cal_d(p[i], t);
  double ans1, ans2, ans3, ans4;
  ans1 = get_val(a) + get_val(b);
  for (int i = 0; i < n; i++) ans1 += vis[i] ? dis[i] : dis[i] * 2.0;
  memset(vis, false, sizeof(vis));
  ans2 = get_val(b) + get_val(a);
  for (int i = 0; i < n; i++) ans2 += vis[i] ? dis[i] : dis[i] * 2.0;
  memset(vis, false, sizeof(vis));
  ans3 = get_val(a);
  for (int i = 0; i < n; i++) ans3 += vis[i] ? dis[i] : dis[i] * 2.0;
  memset(vis, false, sizeof(vis));
  ans4 = get_val(b);
  for (int i = 0; i < n; i++) ans4 += vis[i] ? dis[i] : dis[i] * 2.0;
  printf("%.10f\n", min(min(ans1, ans2), min(ans3, ans4)));
  return 0;
}
