#include <bits/stdc++.h>
using namespace std;
long long ax, ay, bx, by, tx, ty;
int n;
long long x[110000];
long long y[110000];
long double solve(int cnt) {
  long double res = 0;
  int p = 0;
  long double v = sqrt((x[0] - ax) * (x[0] - ax) + (y[0] - ay) * (y[0] - ay)) -
                  sqrt((x[0] - tx) * (x[0] - tx) + (y[0] - ty) * (y[0] - ty));
  for (int i = 1; i < n; ++i) {
    long double cur =
        sqrt((x[i] - ax) * (x[i] - ax) + (y[i] - ay) * (y[i] - ay)) -
        sqrt((x[i] - tx) * (x[i] - tx) + (y[i] - ty) * (y[i] - ty));
    if (cur < v) v = cur, p = i;
  }
  res += v;
  if (cnt == 1) return res;
  int q = 0;
  v = sqrt((x[0] - bx) * (x[0] - bx) + (y[0] - by) * (y[0] - by)) -
      sqrt((x[0] - tx) * (x[0] - tx) + (y[0] - ty) * (y[0] - ty));
  for (int i = 1; i < n; ++i) {
    if (i == p) continue;
    long double cur =
        sqrt((x[i] - bx) * (x[i] - bx) + (y[i] - by) * (y[i] - by)) -
        sqrt((x[i] - tx) * (x[i] - tx) + (y[i] - ty) * (y[i] - ty));
    if (cur < v || p == q) v = cur, q = i;
  }
  res += v;
  return res;
}
int main() {
  ios::sync_with_stdio(0);
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> x[i] >> y[i];
  if (n == 1) {
    long double v = sqrt((x[0] - tx) * (x[0] - tx) + (y[0] - ty) * (y[0] - ty));
    cout << setprecision(10) << fixed
         << min(sqrt((x[0] - ax) * (x[0] - ax) + (y[0] - ay) * (y[0] - ay)),
                sqrt((x[0] - bx) * (x[0] - bx) + (y[0] - by) * (y[0] - by))) +
                v
         << "\n";
    return 0;
  }
  long double ans = 0;
  for (int i = 0; i < n; ++i)
    ans += 2.0 * sqrt((x[i] - tx) * (x[i] - tx) + (y[i] - ty) * (y[i] - ty));
  long double res = ans + solve(1);
  res = min(res, ans + solve(2));
  swap(ax, bx);
  swap(ay, by);
  res = min(res, ans + solve(1));
  res = min(res, ans + solve(2));
  cout << setprecision(10) << fixed << res << "\n";
}
