#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const double pi = acos(-1);
inline int read() {
  int a = 0;
  char c;
  while (isdigit(c = getchar())) a = a * 10 + c - '0';
  return a;
}
const double inf = 1e50;
const int N = 100010;
double x[N], y[N], d[N];
void solve(int ncase) {
  double ax, ay, bx, by, tx, ty;
  int n;
  cin >> ax >> ay >> bx >> by >> tx >> ty >> n;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
  }
  double diffa[2] = {inf, inf};
  int firsta[2] = {-1, -1};
  double diffb[2] = {inf, inf};
  int firstb[2] = {-1, -1};
  for (int i = 0; i < n; i++) {
    d[i] = sqrt((tx - x[i]) * (tx - x[i]) + (ty - y[i]) * (ty - y[i]));
    double da = sqrt((ax - x[i]) * (ax - x[i]) + (ay - y[i]) * (ay - y[i]));
    double db = sqrt((bx - x[i]) * (bx - x[i]) + (by - y[i]) * (by - y[i]));
    if (da - d[i] < diffa[1]) {
      diffa[1] = da - d[i];
      firsta[1] = i;
      if (diffa[1] < diffa[0]) {
        swap(diffa[0], diffa[1]);
        swap(firsta[0], firsta[1]);
      }
    }
    if (db - d[i] < diffb[1]) {
      diffb[1] = db - d[i];
      firstb[1] = i;
      if (diffb[1] < diffb[0]) {
        swap(diffb[0], diffb[1]);
        swap(firstb[0], firstb[1]);
      }
    }
  }
  double sum = 0;
  for (int i = 0; i < n; i++) {
    sum += d[i];
  }
  double ans = inf;
  ans = min(ans, sum * 2 + diffb[0]);
  ans = min(ans, sum * 2 + diffa[0]);
  if (firsta[0] != firstb[0]) ans = min(ans, sum * 2 + diffa[0] + diffb[0]);
  if (firsta[0] != firstb[1]) ans = min(ans, sum * 2 + diffa[0] + diffb[1]);
  if (firsta[1] != firstb[0]) ans = min(ans, sum * 2 + diffa[1] + diffb[0]);
  cout << std::fixed << setprecision(16) << ans << endl;
}
int main() {
  int T = 1;
  int ncase = 0;
  while (T--) {
    solve(++ncase);
  }
}
