#include <bits/stdc++.h>
using namespace std;
long long int fast_exp(long long int a, long long int b) {
  if (a == 0) return 0;
  if (b == 0) return 1;
  if (b == 1) return a;
  if (b % 2 == 0) {
    return fast_exp(((a % 1000000007) * (a % 1000000007)) % 1000000007, b / 2) %
           1000000007;
  }
  return ((a % 1000000007) *
          fast_exp(((a % 1000000007) * (a % 1000000007)) % 1000000007,
                   (b - 1) / 2)) %
         1000000007;
}
long long int comb(long long int n, long long int k) {
  long long int ans = 1, j = 1;
  k = max(k, n - k);
  for (long long int i = n; i > k; --i) {
    ans *= i;
    if (j <= (n - k)) {
      ans = ans / j;
      j++;
    }
  }
  if (j <= (n - k)) {
    ans = ans / j;
    j++;
  }
  return ans;
}
struct node {
  long long int x, y;
};
long long int ax, bx, ay, by, binx, biny;
node ar[100005];
double disA[100005], disB[100005], disBin[100005];
double dist(long long int x1, long long int y1, long long int x2,
            long long int y2) {
  double ans = sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
  return ans;
}
int main() {
  cin >> ax >> ay >> bx >> by >> binx >> biny;
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> ar[i].x >> ar[i].y;
    disBin[i] = dist(binx, biny, ar[i].x, ar[i].y);
    disA[i] = -disBin[i] + dist(ax, ay, ar[i].x, ar[i].y);
    disB[i] = -disBin[i] + dist(bx, by, ar[i].x, ar[i].y);
  }
  int optimalA1 = 1, optimalA2, optimalB1 = 1, optimalB2;
  double T = 0.0;
  for (int i = 1; i <= n; i++) {
    T += 2.0 * disBin[i];
    if (disA[i] < disA[optimalA1]) {
      optimalA1 = i;
    }
    if (disB[i] < disB[optimalB1]) {
      optimalB1 = i;
    }
  }
  optimalA2 = (optimalA1 + 1) % n;
  optimalB2 = (optimalB1 + 1) % n;
  for (int i = 1; i <= n; i++) {
    if (disA[i] < disA[optimalA2] && i != optimalA1) {
      optimalA2 = i;
    }
    if (disB[i] < disB[optimalB2] && i != optimalB1) {
      optimalB2 = i;
    }
  }
  if (binx == ax && biny == ay || binx == bx && biny == by) {
    cout << fixed << setprecision(10) << T;
    return 0;
  }
  if (optimalB1 == optimalA1) {
    T = min(
        T + disA[optimalA1],
        min(T + disB[optimalB1], min(T + disA[optimalA1] + disB[optimalB2],
                                     T + disA[optimalA2] + disB[optimalB1])));
  } else {
    T = min(T + disA[optimalA1],
            min(T + disB[optimalB1], T + disA[optimalA1] + disB[optimalB1]));
  }
  cout << fixed << setprecision(10) << T;
  return 0;
}
