#include <bits/stdc++.h>
using namespace std;
const long double inf = 1e18;
const long double eps = 1e-8;
bool lt(long double a, long double b) { return b - a > eps; }
struct pt {
  long double x, y;
};
long double dist(const pt& a, const pt& b) {
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
int main() {
  pt a, b, c;
  cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y;
  int n;
  cin >> n;
  vector<pt> p(n);
  for (int i = 0; i < n; ++i) {
    cin >> p[i].x >> p[i].y;
  }
  if (n == 1) {
    long double ans = inf;
    long double r = dist(a, p[0]) + dist(c, p[0]);
    if (lt(r, ans)) {
      ans = r;
    }
    r = dist(b, p[0]) + dist(c, p[0]);
    if (lt(r, ans)) {
      ans = r;
    }
    cout << fixed;
    cout.precision(12);
    cout << ans << "\n";
    return 0;
  }
  long double sum = 0;
  vector<long double> v(n);
  for (int i = 0; i < n; ++i) {
    sum += 2 * dist(c, p[i]);
  }
  for (int i = 0; i < n; ++i) {
    v[i] = sum - 2 * dist(c, p[i]) + dist(b, p[i]) + dist(c, p[i]);
  }
  long double best = inf;
  int bestx = -1;
  for (int i = 0; i < n; ++i) {
    if (lt(v[i], best)) {
      best = v[i];
      bestx = i;
    }
  }
  long double ans = best;
  best = inf;
  int besty = -1;
  for (int i = 0; i < n; ++i) {
    if (lt(v[i], best) && i != bestx) {
      best = v[i];
      besty = i;
    }
  }
  for (int i = 0; i < n; ++i) {
    long double curr = dist(a, p[i]) + dist(c, p[i]);
    long double r1 = inf;
    if (bestx != -1 && bestx != i) {
      r1 = curr + v[bestx] - 2 * dist(c, p[i]);
    }
    long double r2 = inf;
    if (besty != -1 && besty != i) {
      r2 = curr + v[besty] - 2 * dist(c, p[i]);
    }
    long double r3 = curr + (sum - 2 * dist(c, p[i]));
    if (lt(r1, ans)) {
      ans = r1;
    }
    if (lt(r2, ans)) {
      ans = r2;
    }
    if (lt(r3, ans)) {
      ans = r3;
    }
  }
  cout << fixed;
  cout.precision(12);
  cout << ans << "\n";
}
