#include <bits/stdc++.h>
using namespace std;
void fun() {}
long long int md = 1e9 + 7;
long long int __gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return __gcd(b, a % b);
}
long long int poww(long long int a, long long int b, long long int md) {
  long long int res = 1;
  while (b) {
    if (b & 1) {
      res *= a;
      res %= md;
    }
    a *= a;
    a %= md;
    b >>= 1;
  }
  return res;
}
map<char, long long int> mapp;
long long int arr[53];
bool dp[53][53][53][53];
bool calc[53][53][53][53];
bool compat(long long int num, long long int num2) {
  if (num % 100 == num2 % 100 || num / 100 == num2 / 100) {
    return true;
  }
  return false;
}
bool solve(long long int idx, long long int last, long long int seclast,
           long long int thirdlast) {
  if (idx == 0) {
    return true;
  } else if (idx == 1) {
    if (compat(arr[last], arr[seclast])) {
      return true;
    }
    return false;
  } else if (idx == 2) {
    if (compat(arr[last], arr[seclast]) && compat(arr[last], arr[thirdlast])) {
      return true;
    }
    return false;
  }
  if (calc[idx][last][seclast][thirdlast]) {
    return dp[idx][last][seclast][thirdlast];
  }
  bool ans = false;
  if (compat(arr[last], arr[seclast])) {
    ans = solve(idx - 1, last, thirdlast, idx - 3);
  }
  if (compat(arr[last], arr[idx - 3])) {
    ans = ans || (solve(idx - 1, seclast, thirdlast, last));
  }
  calc[idx][last][seclast][thirdlast] = true;
  dp[idx][last][seclast][thirdlast] = ans;
  return ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  fun();
  double ax, ay, bx, by, tx, ty;
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  long long int n;
  cin >> n;
  vector<pair<double, long long int> > adil;
  vector<pair<double, long long int> > berra;
  double a, b;
  double sum = 0;
  double dis;
  for (long long int i = 0; i < n; i++) {
    cin >> a >> b;
    dis = sqrt((a - tx) * (a - tx) + (b - ty) * (b - ty));
    sum += 2 * dis;
    double disad = sqrt((a - ax) * (a - ax) + (b - ay) * (b - ay)) - dis;
    adil.push_back(make_pair(disad, i));
    double disb = sqrt((a - bx) * (a - bx) + (b - by) * (b - by)) - dis;
    berra.push_back(make_pair(disb, i));
  }
  sort(adil.begin(), adil.end());
  sort(berra.begin(), berra.end());
  double ans = 1e15;
  ans = min(ans, sum + adil[0].first);
  ans = min(ans, sum + berra[0].first);
  if (adil[0].second != berra[0].second) {
    ans = min(ans, sum + adil[0].first + berra[0].first);
  } else {
    ans = min(ans, sum + adil[0].first + berra[1].first);
    ans = min(ans, sum + adil[1].first + berra[0].first);
  }
  cout << setprecision(20) << ans << "\n";
}
