#include <bits/stdc++.h>
using namespace std;
struct Point {
  long long x, y;
  long double dist(Point an) {
    return sqrt((x - an.x) * (x - an.x) + (y - an.y) * (y - an.y));
  }
};
const int maxn = 1e5 + 5;
Point p[maxn];
Point A, B, U;
int n;
int main() {
  cin >> A.x >> A.y >> B.x >> B.y >> U.x >> U.y >> n;
  long double sum = 0.0;
  for (int j = 0; j < (int)n; j++) {
    cin >> p[j].x >> p[j].y;
    sum += 2 * p[j].dist(U);
  }
  pair<long double, int> min1 = make_pair(0.0, -1);
  pair<long double, int> min2 = make_pair(0.0, -1);
  long double best;
  for (int j = 0; j < (int)n; j++) {
    long double val = B.dist(p[j]) - U.dist(p[j]);
    if (val < min1.first) {
      min2 = min1;
      min1 = make_pair(val, j);
    } else if (val < min2.first) {
      min2 = make_pair(val, j);
    }
    if (j == 0 || sum + val < best) {
      best = sum + val;
    }
  }
  for (int j = 0; j < (int)n; j++) {
    long double nnew = sum;
    nnew = nnew - U.dist(p[j]) + A.dist(p[j]);
    if (j == min1.second)
      nnew = nnew + min2.first;
    else
      nnew = nnew + min1.first;
    if (nnew < best) best = nnew;
  }
  printf("%.10lf\n", (double)best);
}
