#include <bits/stdc++.h>
using namespace std;
const double kEps = 1.0E-8;
struct Point {
  int x, y;
};
double Dist(const Point& a, const Point& b) {
  return sqrt(1LL * (a.x - b.x) * (a.x - b.x) +
              1LL * (a.y - b.y) * (a.y - b.y));
}
double SolveSingle(const Point& A, const vector<pair<Point, double>>& pts,
                   double sum) {
  double r = numeric_limits<double>::max();
  for (const auto& p : pts) {
    r = min(r, Dist(A, p.first) - p.second);
  }
  return sum + r;
}
double SolveDoulbe(const Point& A, const Point& B,
                   const vector<pair<Point, double>>& pts, double sum) {
  double r1 = numeric_limits<double>::max();
  vector<int> cand_indexes;
  for (int i = 0; i < pts.size(); ++i) {
    double c = Dist(A, pts[i].first) - pts[i].second;
    if (c < r1 - kEps) {
      r1 = c;
      cand_indexes.clear();
      cand_indexes.push_back(i);
    } else if (fabs(c - r1) < kEps) {
      cand_indexes.push_back(i);
    }
  }
  double r2 = numeric_limits<double>::max();
  bool can_all = cand_indexes.size() > 1;
  for (int i = 0; i < pts.size(); ++i) {
    if (can_all ||
        !binary_search(cand_indexes.begin(), cand_indexes.end(), i)) {
      r2 = min(r2, Dist(B, pts[i].first) - pts[i].second);
    }
  }
  return sum + r1 + r2;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  Point A, B, T;
  cin >> A.x >> A.y >> B.x >> B.y >> T.x >> T.y;
  int N;
  cin >> N;
  vector<pair<Point, double>> pts(N);
  double sum = 0;
  for (auto& p : pts) {
    cin >> p.first.x >> p.first.y;
    p.second = Dist(p.first, T);
    sum += 2 * p.second;
  }
  double result = SolveSingle(A, pts, sum);
  result = min(result, SolveSingle(B, pts, sum));
  result = min(result, SolveDoulbe(A, B, pts, sum));
  result = min(result, SolveDoulbe(B, A, pts, sum));
  cout.precision(12);
  cout << fixed << result << '\n';
  return 0;
}
