#include <bits/stdc++.h>
using namespace std;
pair<int, int> a, b, t, points[100000];
int n;
double d[100000];
pair<double, int> s1[100000], s2[100000];
double dist(pair<int, int> first, pair<int, int> second) {
  long long x = first.first - second.first;
  long long y = first.second - second.second;
  return sqrt(x * x + y * y);
}
int main() {
  cin >> a.first >> a.second >> b.first >> b.second >> t.first >> t.second >> n;
  double ans = 0;
  for (int i = 0; i < n; i++) {
    cin >> points[i].first >> points[i].second;
    d[i] = dist(points[i], t);
    ans += 2 * d[i];
    s1[i] = pair<double, int>(dist(a, points[i]) - d[i], i);
    s2[i] = pair<double, int>(dist(b, points[i]) - d[i], i);
  }
  sort(s1, s1 + n);
  sort(s2, s2 + n);
  double ans1;
  double ans2;
  double ans3;
  ans1 = ans + s1[0].first;
  ans2 = ans + s2[0].first;
  if (s1[0].second != s2[0].second) {
    ans3 = ans + s1[0].first + s2[0].first;
  } else
    ans3 = ans + min(s1[0].first + s2[1].first, s1[1].first + s2[0].first);
  cout << setprecision(9);
  cout << min(ans1, min(ans2, ans3));
}
