#include <bits/stdc++.h>
using namespace std;
void task();
int main() {
  task();
  return 0;
}
const int N = 2e5 + 10;
const long long int MOD = (long long int)1e9 + 7;
const int INF = 0x3f3f3f3f;
const long long int LINF = (long long int)4e18 + 100;
const int BUF_SIZE = (int)1e6 + 10;
const double PI = acos(-1);
pair<int, int> a[N];
double u[N], ad[N], bd[N];
long long int sq_dist(long long int x1, long long int y1, long long int x2,
                      long long int y2) {
  return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
}
double dist(long long int x1, long long int y1, long long int x2,
            long long int y2) {
  return sqrt(sq_dist(x1, y1, x2, y2));
}
double dp[N][2][2];
void task() {
  int ai, aj, bi, bj, ui, uj;
  cin >> ai >> aj >> bi >> bj >> ui >> uj;
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i].first >> a[i].second;
  }
  for (int i = 0; i < n; ++i) {
    u[i] = dist(ui, uj, a[i].first, a[i].second);
    (void(1));
    ;
  }
  for (int i = 0; i < n; ++i) {
    ad[i] = dist(ai, aj, a[i].first, a[i].second) + u[i];
    (void(1));
    ;
  }
  for (int i = 0; i < n; ++i) {
    bd[i] = dist(bi, bj, a[i].first, a[i].second) + u[i];
    (void(1));
    ;
  }
  fill(dp[0][0], dp[0][0] + N * 2 * 2, LINF);
  dp[0][1][1] = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < 2; ++j) {
      for (int k = 0; k < 2; ++k) {
        (void(1));
        ;
        if (j == 1) {
          dp[i + 1][j - 1][k] = min(dp[i][j][k] + ad[i], dp[i + 1][j - 1][k]);
        }
        if (k == 1) {
          dp[i + 1][j][k - 1] = min(dp[i][j][k] + bd[i], dp[i + 1][j][k - 1]);
        }
        dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k] + 2 * u[i]);
      }
    }
  }
  double ans = LINF;
  for (int i = 0; i < 2; ++i) {
    for (int j = 0; j < 2; ++j)
      if (!(i == 1 && j == 1)) {
        (void(1));
        ;
        ans = min(ans, dp[n][i][j]);
      }
  }
  cout << fixed << setprecision(12) << ans;
}
