#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  std::cerr << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  std::cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const long long int mxx = 5005, INFF = 1e9;
pair<long long int, long long int> person[2], bin, trash[100005];
long double profit[2][100005];
long long int best[2], corx, cory, n;
void in() { cin >> corx >> cory; }
long double dis(pair<long long int, long long int> a,
                pair<long long int, long long int> b) {
  long double x1 = a.first, y1 = a.second, x2 = b.first, y2 = b.second;
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
void solve() {
  for (long long int i = 0; i < 2; i++) {
    in();
    person[i] = {corx, cory};
  }
  in();
  bin = {corx, cory};
  cin >> n;
  for (long long int i = 0; i < n; i++) {
    in();
    trash[i] = {corx, cory};
    profit[0][i + 1] = dis(bin, trash[i]) - dis(trash[i], person[0]);
    profit[1][i + 1] = dis(bin, trash[i]) - dis(trash[i], person[1]);
  }
  long long int ind_of_max = 1;
  for (long long int i = 1; i <= n; i++)
    if (profit[0][i] > profit[0][ind_of_max]) ind_of_max = i;
  best[0] = ind_of_max;
  if (best[0] == 1) best[1] = 2;
  for (long long int i = 1; i <= n; i++) {
    if (i != ind_of_max && profit[1][best[1]] < profit[1][i]) {
      best[1] = i;
    }
  }
  long long int temp_best0 = 1, temp_best1 = 1;
  if (ind_of_max == 1) temp_best0 = 2;
  for (long long int i = 1; i <= n; i++) {
    if (i != ind_of_max && profit[0][i] > profit[0][temp_best0]) {
      temp_best0 = i;
    }
  }
  if (temp_best0 == 1) temp_best1 = 2;
  for (long long int i = 1; i <= n; i++) {
    if (i != temp_best0 && profit[1][temp_best1] < profit[1][i]) {
      temp_best1 = i;
    }
  }
  if (profit[0][ind_of_max] + profit[1][best[1]] <
      profit[0][temp_best0] + profit[1][temp_best1]) {
    best[0] = temp_best0;
    best[1] = temp_best1;
  }
  long double ans = 0;
  for (long long int i = 0; i < n; i++) {
    if (i + 1 == best[0]) {
      ans += dis(trash[i], person[0]);
    } else {
      if (i + 1 == best[1])
        ans += dis(trash[i], person[1]);
      else
        ans += dis(bin, trash[i]);
    }
  }
  for (long long int i = 0; i < n; i++) ans += dis(bin, trash[i]);
  long double temp = 0, sum = 0;
  for (long long int i = 0; i < n; i++) {
    temp += dis(bin, trash[i]);
    temp += dis(bin, trash[i]);
  }
  sum = temp;
  ans = min(ans, temp + min(dis(bin, person[0]), dis(bin, person[1])));
  ;
  temp = 0;
  for (long long int i = 0; i < n; i++) {
    ans = min(ans, sum + dis(person[0], trash[i]) - dis(bin, trash[i]));
    ;
    ans = min(ans, sum + dis(person[1], trash[i]) - dis(bin, trash[i]));
    ;
  }
  cout << fixed << setprecision(25) << ans;
  ;
  return;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
