#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
long double a[N];
long long x[N], y[N];
long double sum;
long long xa, ya, xb, yb, xt, yt;
long double dis(long long a, long long b, long long c, long long d) {
  return sqrt((a - c) * (a - c) + (b - d) * (b - d));
}
int main() {
  ios::sync_with_stdio(false);
  cin >> xa >> ya;
  cin >> xb >> yb;
  cin >> xt >> yt;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    a[i] = dis(x[i], y[i], xt, yt);
    sum += a[i];
  }
  int mn1 = -1, mn2 = -1;
  for (int i = 0; i < n; i++) {
    long double ne = dis(xa, ya, x[i], y[i]) - a[i];
    if (mn1 == -1 || dis(xa, ya, x[mn1], y[mn1]) - a[mn1] > ne) {
      mn2 = mn1;
      mn1 = i;
    } else if (mn2 == -1 || dis(xa, ya, x[mn2], y[mn2]) - a[mn2] > ne)
      mn2 = i;
  }
  long double ans = sum + sum - a[mn1] + dis(xa, ya, x[mn1], y[mn1]);
  for (int i = 0; i < n; i++) {
    long double all = sum + sum - a[i] + dis(xb, yb, x[i], y[i]);
    ans = min(ans, all);
    if (mn1 != -1 && mn1 != i)
      all -= a[mn1] - dis(xa, ya, x[mn1], y[mn1]);
    else if (mn2 != -1)
      all -= a[mn2] - dis(xa, ya, x[mn2], y[mn2]);
    ans = min(ans, all);
  }
  cout << setprecision(15) << fixed << ans << "\n";
  return 0;
}
