#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
pair<int, int> BOT[100005];
pair<double, int> TRPA[100005];
pair<double, int> TRPB[100005];
double dist(pair<int, int> a, pair<int, int> b) {
  double A = (a.first - b.first);
  double B = (a.second - b.second);
  return sqrt((A * A) + (B * B));
}
int main() {
  pair<int, int> A, B, T;
  scanf("%d", &A.first);
  scanf("%d", &A.second);
  scanf("%d", &B.first);
  scanf("%d", &B.second);
  scanf("%d", &T.first);
  scanf("%d", &T.second);
  int n, i;
  scanf("%d", &n);
  double ans = 0;
  for (i = 0; i < n; i++) {
    scanf("%d", &BOT[i].first);
    scanf("%d", &BOT[i].second);
    double d = dist(T, BOT[i]);
    TRPA[i] = make_pair(dist(A, BOT[i]) - d, i);
    TRPB[i] = make_pair(dist(B, BOT[i]) - d, i);
    ans += 2 * d;
  }
  sort(TRPA, TRPA + n);
  sort(TRPB, TRPB + n);
  double ans1 = ans, ans2 = ans;
  ans1 += TRPA[0].first;
  ans2 += TRPB[0].first;
  if (TRPB[1].first < 0 && TRPB[0].second == TRPA[0].second)
    ans1 += TRPB[1].first;
  else if (TRPB[0].first < 0 && TRPB[0].second != TRPA[0].second)
    ans1 += TRPB[0].first;
  if (TRPA[1].first < 0 && TRPA[0].second == TRPB[0].second)
    ans2 += TRPA[1].first;
  else if (TRPA[0].first < 0 && TRPB[0].second != TRPA[0].second)
    ans2 += TRPA[0].first;
  printf("%.12lf\n", min(ans1, ans2));
}
