#include <bits/stdc++.h>
using namespace std;
FILE* in = stdin;
FILE* out = stdout;
const int MAX = 100002;
const double INF = 1e100;
struct Point {
  double x, y;
  Point(double x_ = 0.0, double y_ = 0.0) : x(x_), y(y_) {}
};
int n;
Point p[MAX];
Point a, b, o;
double findDist(const Point& p1, const Point& p2) {
  return sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y));
}
double solve() {
  double ans = INF;
  double ret = 0.0;
  for (int i = 0; i < n; i++) {
    ret += findDist(p[i], o) * 2.0;
  }
  int withA1 = -1, withA2 = -1, withB1 = -1, withB2 = -1;
  double bestA1 = -INF, bestA2 = -INF, bestB1 = -INF, bestB2 = -INF;
  for (int i = 0; i < n; i++) {
    double va = findDist(p[i], o) - findDist(p[i], a);
    double vb = findDist(p[i], o) - findDist(p[i], b);
    if (bestA2 < va) bestA2 = va, withA2 = i;
    if (bestA1 < bestA2) swap(bestA1, bestA2), swap(withA1, withA2);
    if (bestB2 < vb) bestB2 = vb, withB2 = i;
    if (bestB1 < bestB2) swap(bestB1, bestB2), swap(withB1, withB2);
  }
  ans = min(ans, ret - bestA1);
  ans = min(ans, ret - bestB1);
  if (withA1 != withB1) {
    ans = min(ans, ret - bestA1 - bestB1);
  } else {
    ans = min(ans, ret - max(bestA1 + bestB2, bestA2 + bestB1));
  }
  return ans;
}
void readPoint(Point& point) { fscanf(in, "%lf %lf", &point.x, &point.y); }
int main(void) {
  readPoint(a);
  readPoint(b);
  readPoint(o);
  fscanf(in, "%d", &n);
  for (int i = 0; i < n; i++) readPoint(p[i]);
  fprintf(out, "%.9lf\n", solve());
  return 0;
}
