#include <bits/stdc++.h>
using namespace std;
double sqr(double x) { return x * x; }
pair<double, double> r[200000];
int main() {
  double ax, ay, bx, by, d, tx, ty, x, y, z = 0, t = -1e9;
  int n, i;
  cin >> ax >> ay >> bx >> by >> tx >> ty >> n;
  for (i = 1; i <= n; i++) {
    cin >> x >> y;
    d = sqrt(sqr(tx - x) + sqr(ty - y)), z += d * 2;
    r[i].first = d - sqrt(sqr(ax - x) + sqr(ay - y));
    r[i].second = d - sqrt(sqr(bx - x) + sqr(by - y));
  }
  sort(r + 1, r + 1 + n);
  t = max(r[n - 1].first + r[n].second, max(r[n].first, r[n].second));
  for (i = n - 1; i > 0; i--)
    t = max(t, max(r[n].first + r[i].second, max(r[i].first, r[i].second)));
  printf("%.9lf", z - t);
}
