#include <bits/stdc++.h>
using namespace std;
inline double Max(double a, double b) {
  if (a < b) return b;
  return a;
}
inline double Min(double a, double b) {
  if (a < b) return a;
  return b;
}
bool comp(pair<double, int> p1, pair<double, int> p2) {
  return p1.first > p2.first;
}
double ans, d, amx1, amx2, bmx1, bmx2, s, t, u;
int p, P;
vector<pair<double, int> > a, b;
int main() {
  int ax, ay, bx, by, rx, ry, x, y, n, i;
  cin >> ax >> ay >> bx >> by >> rx >> ry;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x >> y;
    ans += 2 * hypot(rx - x, ry - y);
    d = hypot(rx - x, ry - y) - hypot(ax - x, ay - y);
    a.push_back(make_pair(d, i));
    d = hypot(rx - x, ry - y) - hypot(bx - x, by - y);
    b.push_back(make_pair(d, i));
  }
  sort(a.begin(), a.end(), comp);
  sort(b.begin(), b.end(), comp);
  amx1 = a[0].first;
  p = a[0].second;
  bmx1 = b[0].first;
  P = b[0].second;
  if (n == 1)
    ans = ans - Max(amx1, bmx1);
  else {
    s = ans - amx1;
    t = ans - bmx1;
    if (p == P) {
      amx2 = a[1].first;
      bmx2 = b[1].first;
      u = ans - Max(amx1 + bmx2, amx2 + bmx1);
    } else
      u = ans - (amx1 + bmx1);
    ans = Min(Min(s, t), u);
  }
  cout << fixed << ans;
  return 0;
}
