#include <bits/stdc++.h>
using namespace std;
double d(long long int x, long long int y, long long int x1, long long int y1) {
  return sqrt((x - x1) * (x - x1) + (y - y1) * (y - y1));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  pair<long long int, long long int> adil;
  pair<long long int, long long int> bera;
  pair<long long int, long long int> bin;
  cin >> adil.first >> adil.second >> bera.first >> bera.second >> bin.first >>
      bin.second;
  double sum = 0;
  long long int n;
  cin >> n;
  pair<int, int> MinAdil, Min1Adil, MinBera, Min1Bera;
  double a, a1, b, b1;
  a = a1 = b = b1 = 1e10;
  for (int i = 0; i < n; i++) {
    long long int x, y;
    cin >> x >> y;
    double dist = d(x, y, bin.first, bin.second);
    sum += dist * 2;
    double krati = d(adil.first, adil.second, x, y) - dist;
    double t = dist;
    dist = krati;
    if (dist <= a) {
      Min1Adil.first = MinAdil.first;
      Min1Adil.second = MinAdil.second;
      MinAdil.first = x;
      MinAdil.second = y;
      a1 = a;
      a = dist;
    } else {
      if (dist < a1) {
        Min1Adil.first = x;
        Min1Adil.second = y;
        a1 = dist;
      }
    }
    dist = d(bera.first, bera.second, x, y) - t;
    if (dist <= b) {
      Min1Bera.first = MinBera.first;
      Min1Bera.second = MinBera.second;
      MinBera.first = x;
      MinBera.second = y;
      b1 = b;
      b = dist;
    } else {
      if (dist < b1) {
        Min1Bera.first = x;
        Min1Bera.second = y;
        b1 = dist;
      }
    }
  }
  double ans =
      min(sum - d(bin.first, bin.second, MinAdil.first, MinAdil.second) +
              d(MinAdil.first, MinAdil.second, adil.first, adil.second),
          sum - d(bin.first, bin.second, MinBera.first, MinBera.second) +
              d(MinBera.first, MinBera.second, bera.first, bera.second));
  if (n > 1) {
    if (MinAdil.first == MinBera.first && MinAdil.second == MinBera.second) {
      ans = min(
          ans, sum - d(bin.first, bin.second, MinAdil.first, MinAdil.second) -
                   d(bin.first, bin.second, Min1Bera.first, Min1Bera.second) +
                   d(MinAdil.first, MinAdil.second, adil.first, adil.second) +
                   d(Min1Bera.first, Min1Bera.second, bera.first, bera.second));
      ans = min(
          ans, sum - d(bin.first, bin.second, Min1Adil.first, Min1Adil.second) -
                   d(bin.first, bin.second, MinBera.first, MinBera.second) +
                   d(Min1Adil.first, Min1Adil.second, adil.first, adil.second) +
                   d(MinBera.first, MinBera.second, bera.first, bera.second));
    } else {
      ans = min(ans,
                sum - d(bin.first, bin.second, MinAdil.first, MinAdil.second) -
                    d(bin.first, bin.second, MinBera.first, MinBera.second) +
                    d(MinAdil.first, MinAdil.second, adil.first, adil.second) +
                    d(MinBera.first, MinBera.second, bera.first, bera.second));
    }
  }
  cout << setprecision(10) << fixed << ans;
  return 0;
}
