#include <bits/stdc++.h>
using namespace std;
double INF = 1e100;
double EPS = 1e-12;
const double PI = atan(1) * 4;
struct Point {
  double x, y;
  Point() {}
  Point(double _x, double _y) : x(_x), y(_y) {}
  bool operator<(const Point &other) {
    if (fabs(x - other.x) < EPS) return y < other.y;
    return x < other.x;
  }
};
double dist(const Point &a, const Point &b) {
  return hypot(a.x - b.x, a.y - b.y);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  Point a, b, bin;
  cin >> a.x >> a.y >> b.x >> b.y >> bin.x >> bin.y;
  int n;
  cin >> n;
  vector<Point> all(n);
  double tot = 0;
  for (int i = 0; i < n; i++) {
    cin >> all[i].x >> all[i].y;
    tot += 2. * dist(all[i], bin);
  }
  double ans_a = INF, ans_b = INF;
  int aa, bb;
  for (int i = 0; i < n; i++) {
    Point curr = all[i];
    double nw = tot - dist(curr, bin) + dist(a, curr);
    if (nw < ans_a) {
      ans_a = nw;
      aa = i;
    }
    nw = tot - dist(curr, bin) + dist(b, curr);
    if (nw < ans_b) {
      ans_b = nw;
      bb = i;
    }
  }
  double ans = min(ans_a, ans_b);
  double best_fix = INF;
  for (int i = 0; i < n; i++) {
    if (i == aa) continue;
    Point curr = all[i];
    double nw = ans_a - dist(curr, bin) + dist(b, curr);
    if (nw < best_fix) best_fix = nw;
  }
  ans = min(ans, best_fix);
  best_fix = INF;
  for (int i = 0; i < n; i++) {
    if (i == bb) continue;
    Point curr = all[i];
    double nw = ans_b - dist(curr, bin) + dist(a, curr);
    if (nw < best_fix) best_fix = nw;
  }
  ans = min(ans, best_fix);
  cout << fixed << setprecision(17) << ans << '\n';
  return 0;
}
