#include <bits/stdc++.h>
using namespace std;
int N;
long long ax, ay, bx, by, tx, ty;
long long X[100005], Y[100005];
long double dp[100005][2][2];
long double find_dist(long long x1, long long y1, long long x2, long long y2) {
  return (long double)sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
long double solve(int N, int x, int y) {
  if (N == 0) {
    if (!x && !y) return 0;
    return 1e10;
  }
  if (fabs(dp[N][x][y] + 1) > 1e-11) return dp[N][x][y];
  long double ans = 2 * find_dist(tx, ty, X[N], Y[N]) + solve(N - 1, x, y);
  if (x)
    ans = min(ans, find_dist(ax, ay, X[N], Y[N]) +
                       find_dist(X[N], Y[N], tx, ty) + solve(N - 1, 0, y));
  if (y)
    ans = min(ans, find_dist(bx, by, X[N], Y[N]) +
                       find_dist(X[N], Y[N], tx, ty) + solve(N - 1, x, 0));
  return dp[N][x][y] = ans;
}
int main() {
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  cin >> N;
  for (int i = 1; i <= N; i++) scanf("%lld %lld", &X[i], &Y[i]);
  for (int i = 0; i <= N + 1; i++)
    for (int j = 0; j <= 1; j++)
      for (int k = 0; k <= 1; k++) dp[i][j][k] = -1;
  cout << setprecision(18)
       << min(solve(N, 1, 1), min(solve(N, 1, 0), solve(N, 0, 1)));
  return 0;
}
