#include <bits/stdc++.h>
using namespace std;
int n, m;
double ax, ay, bx, by, tx, ty, x, y;
char s[100100];
double len(double x1, double y1, double x2, double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  cin >> n;
  vector<pair<double, int> > v1, v2;
  double total = 0;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    v1.push_back(make_pair(len(ax, ay, x, y) - len(tx, ty, x, y), i));
    v2.push_back(make_pair(len(bx, by, x, y) - len(tx, ty, x, y), i));
    total += 2 * len(tx, ty, x, y);
  }
  sort(v1.begin(), v1.end());
  sort(v2.begin(), v2.end());
  double res = total;
  double case1 = total + v1[0].first;
  double case2 = total + v2[0].first;
  res = min(case1, case2);
  if (v1[0].second != v2[0].second) {
    double case3 = total + v1[0].first + v2[0].first;
    res = min(res, case3);
  } else if (n > 1) {
    double case4 = total + v1[0].first + v2[1].first;
    res = min(res, case4);
    double case5 = total + v1[1].first + v2[0].first;
    res = min(res, case5);
  }
  printf("%.10lf", res);
  return 0;
}
