#include <bits/stdc++.h>
using namespace std;
int64_t max(int32_t a, int64_t b) { return max((int64_t)a, b); }
const double INF = 1e18;
struct X {
  double to_bin;
  double adil;
  double bera;
};
X dist[222000];
double dp[222000][4][4];
double dst(int64_t x1, int64_t y1, int64_t x2, int64_t y2) {
  return (sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)));
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(16);
  int64_t tx, ty;
  vector<pair<int64_t, int64_t> > pos(2);
  cin >> pos[0].first >> pos[0].second >> pos[1].first >> pos[1].second >> tx >>
      ty;
  int64_t n;
  cin >> n;
  for (int64_t i = 0; i < n; i++) {
    int64_t x, y;
    cin >> x >> y;
    dist[i].to_bin = dst(x, y, tx, ty) * 2;
    dist[i].adil = dst(x, y, tx, ty) + dst(x, y, pos[0].first, pos[0].second);
    dist[i].bera = dst(x, y, tx, ty) + dst(x, y, pos[1].first, pos[1].second);
  }
  for (int64_t i = 0; i <= n; i++) {
    for (int64_t j = 0; j < 2; j++) {
      for (int64_t f = 0; f < 2; f++) {
        dp[i][j][f] = INF;
      }
    }
  }
  dp[0][0][0] = dist[0].to_bin;
  dp[0][1][0] = dist[0].adil;
  dp[0][0][1] = dist[0].bera;
  for (int64_t i = 1; i < n; i++) {
    dp[i][0][0] = dp[i - 1][0][0] + dist[i].to_bin;
    dp[i][1][0] =
        min(dp[i - 1][1][0] + dist[i].to_bin, dp[i - 1][0][0] + dist[i].adil);
    dp[i][0][1] =
        min(dp[i - 1][0][1] + dist[i].to_bin, dp[i - 1][0][0] + dist[i].bera);
    dp[i][1][1] = min(
        dp[i - 1][1][1] + dist[i].to_bin,
        min(dp[i - 1][0][1] + dist[i].adil, dp[i - 1][1][0] + dist[i].bera));
  }
  cout << min(dp[n - 1][1][1], min(dp[n - 1][1][0], dp[n - 1][0][1]));
}
