#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int x[N], y[N];
template <class T>
T sq(T x) {
  return x * x;
}
double dp[N][4];
int main() {
  cout.sync_with_stdio(0);
  cin.tie(0);
  int a[2], b[2], t[2];
  for (int _n(2), i(0); i < _n; i++) cin >> a[i];
  for (int _n(2), i(0); i < _n; i++) cin >> b[i];
  for (int _n(2), i(0); i < _n; i++) cin >> t[i];
  int n;
  cin >> n;
  for (int _n(n), i(0); i < _n; i++) cin >> x[i] >> y[i];
  for (int _n(N), i(0); i < _n; i++)
    for (int _n(4), k(0); k < _n; k++) dp[i][k] = 1e40;
  dp[0][3] = 0;
  for (int _n(n), i(0); i < _n; i++)
    for (int _n(4), k(0); k < _n; k++) {
      double da = sqrt(sq<double>(x[i] - a[0]) + sq<double>(y[i] - a[1]));
      double db = sqrt(sq<double>(x[i] - b[0]) + sq<double>(y[i] - b[1]));
      double dt = sqrt(sq<double>(x[i] - t[0]) + sq<double>(y[i] - t[1]));
      da += dt;
      db += dt;
      dt *= 2;
      if (k & 1) {
        dp[i + 1][k ^ 1] = min(dp[i + 1][k ^ 1], dp[i][k] + da);
      }
      if (k & 2) {
        dp[i + 1][k ^ 2] = min(dp[i + 1][k ^ 2], dp[i][k] + db);
      }
      dp[i + 1][k] = min(dp[i + 1][k], dp[i][k] + dt);
    }
  double ans = 1e40;
  for (int _n(3), i(0); i < _n; i++) ans = min(ans, dp[n][i]);
  cout.precision(9);
  cout << fixed << ans << endl;
  return 0;
}
