#include <bits/stdc++.h>
using namespace std;
const long long N = 100010;
struct point {
  pair<double, double> c;
  long long ind;
};
double dist(point x, point y) {
  return sqrt((x.c.first - y.c.first) * (x.c.first - y.c.first) +
              (x.c.second - y.c.second) * (x.c.second - y.c.second));
}
point p1[N], p2[N];
point a, b, t;
bool comp1(point A, point B) {
  return dist(A, a) + dist(t, B) < dist(a, B) + dist(t, A);
}
bool comp2(point A, point B) {
  return dist(A, b) + dist(t, B) < dist(b, B) + dist(t, A);
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> a.c.first >> a.c.second >> b.c.first >> b.c.second >> t.c.first >>
      t.c.second;
  long long n;
  cin >> n;
  double sum = 0;
  for (long long i = 0; i < n; i++) {
    cin >> p1[i].c.first >> p1[i].c.second;
    p1[i].ind = i;
    p2[i].ind = i;
    p2[i].c.first = p1[i].c.first;
    p2[i].c.second = p1[i].c.second;
    sum += 2 * dist(p1[i], t);
  }
  cout.precision(7);
  cout.setf(ios::fixed);
  if (n == 1) {
    cout << sum / 2 + min(dist(a, p1[0]), dist(b, p1[0]));
    return 0;
  }
  sort(p1, p1 + n, comp1);
  sort(p2, p2 + n, comp2);
  double ans = sum - dist(p1[0], t) + dist(a, p1[0]);
  ans = min(ans, sum - dist(p2[0], t) + dist(b, p2[0]));
  if (p1[0].ind == p2[0].ind) {
    double case1 =
        sum - dist(p1[0], t) + dist(a, p1[0]) - dist(p2[1], t) + dist(b, p2[1]);
    double case2 =
        sum - dist(p1[1], t) + dist(a, p1[1]) - dist(p2[0], t) + dist(b, p2[0]);
    ans = min(ans, min(case1, case2));
  } else {
    ans = min(ans, sum - dist(p1[0], t) + dist(a, p1[0]) - dist(p2[0], t) +
                       dist(b, p2[0]));
  }
  cout << ans << "\n";
}
