#include <bits/stdc++.h>
long long md = 1000000007;
using namespace std;
using namespace std::chrono;
long long pw(long long a, long long b) {
  long long c = 1, m = a;
  while (b) {
    if (b & 1) c = (c * m);
    m = (m * m);
    b /= 2;
  }
  return c;
}
long long pwmd(long long a, long long b) {
  long long c = 1, m = a;
  while (b) {
    if (b & 1) c = (c * m) % md;
    m = (m * m) % md;
    b /= 2;
  }
  return c;
}
long long modinv(long long n) { return pwmd(n, md - 2); }
long long inverse(long long i) {
  if (i == 1) return 1;
  return (md - ((md / i) * inverse(md % i)) % md + md) % md;
}
long long ceel(long long a, long long b) {
  if (a % b == 0)
    return a / b;
  else
    return a / b + 1;
}
long long my_log(long long n, long long b) {
  long long i = 1;
  long long ans = 0;
  while (1) {
    if (i > n) {
      ans--;
      break;
    }
    if (i == n) break;
    i *= b;
    ans++;
  }
  return ans;
}
bool sortbysec(const pair<long long, long long> &a,
               const pair<long long, long long> &b) {
  return (a.second < b.second);
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
vector<char> capl = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
                     'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
                     'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
vector<char> sml = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
                    'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r',
                    's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
string conv(long long a) {
  string b;
  long long e = 2;
  long long c = my_log(a, e);
  c++;
  b = '1';
  for (int i = 0; i < c - 1; i++) {
    long long k = a >> (c - 2 - i);
    if (k & 1)
      b += '1';
    else
      b += '0';
  }
  if (a == 0) return "0";
  return b;
}
long long mysqt(long long a) {
  long long ans = 1;
  while (ans * ans <= a) ans++;
  ans--;
  return ans;
}
bool isprime(long long p) {
  long long i = 2;
  while (i <= sqrt(p)) {
    if (p % i == 0) {
      return false;
    }
    i++;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  double ax, ay, bx, by, x, y, tx, ty, q, a, b, z = 0;
  long long n;
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  cin >> n;
  vector<pair<double, double>> v;
  for (long long i = 0; i < n; i++) cin >> x >> y, v.push_back({x, y});
  double ans = 0;
  for (long long i = 0; i < n; i++)
    ans += sqrt((v[i].first - tx) * (v[i].first - tx) +
                (v[i].second - ty) * (v[i].second - ty));
  ans *= 2;
  double d1 = sqrt((ax - tx) * (ax - tx) + (ay - ty) * (ay - ty));
  double d2 = sqrt((bx - tx) * (bx - tx) + (by - ty) * (by - ty));
  double mx1 = -d1, mx2 = -d2, i1 = -1, i2 = -2;
  for (long long i = 0; i < n; i++) {
    a = v[i].first, b = v[i].second;
    q = sqrt((a - tx) * (a - tx) + (b - ty) * (b - ty)) -
        sqrt((ax - a) * (ax - a) + (ay - b) * (ay - b));
    if (q > mx1) mx1 = q, i1 = i;
    q = sqrt((a - tx) * (a - tx) + (b - ty) * (b - ty)) -
        sqrt((bx - a) * (bx - a) + (by - b) * (by - b));
    if (q > mx2) mx2 = q, i2 = i;
  }
  if (i1 != i2) {
    if (mx1 >= 0 && mx2 >= 0)
      cout << setprecision(12) << ans - mx1 - mx2;
    else
      cout << setprecision(12) << ans - max(mx1, mx2);
    return 0;
  }
  double mmx1 = -d1, mmx2 = -d2;
  for (long long i = 0; i < n; i++) {
    if (i == i1) continue;
    a = v[i].first, b = v[i].second;
    q = sqrt((a - tx) * (a - tx) + (b - ty) * (b - ty)) -
        sqrt((ax - a) * (ax - a) + (ay - b) * (ay - b));
    if (q > mmx1) mmx1 = q;
    q = sqrt((a - tx) * (a - tx) + (b - ty) * (b - ty)) -
        sqrt((bx - a) * (bx - a) + (by - b) * (by - b));
    if (q > mmx2) mmx2 = q;
  }
  if (mx1 >= 0 && mx2 >= 0)
    cout << setprecision(12)
         << ans - max(mx1 + max(z, mmx2), mx2 + max(z, mmx1));
  else
    cout << setprecision(12) << ans - max(mx1, mx2);
}
