#include <bits/stdc++.h>
using namespace std;
double get(double x1, double x2, double y1, double y2) {
  return sqrt(pow(x1 - x2, 2.0) + pow(y1 - y2, 2.0));
}
const int N = 1e5 + 100;
double x[N], y[N];
int main() {
  double x1, y1, x2, y2, t1, t2;
  int n;
  while (cin >> x1 >> y1 >> x2 >> y2 >> t1 >> t2) {
    cin >> n;
    for (int i = 0; i < (n); ++i) scanf("%lf%lf", &x[i], &y[i]);
    double ret = 0;
    vector<pair<double, int> > vec[2];
    for (int i = 0; i < (n); ++i) {
      ret += get(t1, x[i], t2, y[i]);
      vec[0].push_back(
          make_pair(get(x1, x[i], y1, y[i]) - get(t1, x[i], t2, y[i]), i));
      vec[1].push_back(
          make_pair(get(x2, x[i], y2, y[i]) - get(t1, x[i], t2, y[i]), i));
    }
    for (int i = 0; i < (2); ++i) sort(vec[i].begin(), vec[i].end());
    double tmp = 1e18;
    if (n == 1) {
      for (int i = 0; i < (2); ++i) tmp = min(tmp, vec[i][0].first);
    } else {
      for (int i = 0; i < (2); ++i)
        for (int j = 0; j < (2); ++j) {
          if (vec[0][i].second == vec[1][j].second) continue;
          tmp = min(tmp, vec[0][i].first + vec[1][j].first);
        }
      for (int i = 0; i < (2); ++i) tmp = min(tmp, vec[i][0].first);
    }
    printf("%.8lf\n", ret * 2.0 + tmp);
  }
  return 0;
}
