#include <bits/stdc++.h>
using namespace std;
int ax, ay, bx, by, tx, ty;
int x[100005];
int y[100005];
double val[4];
class A {
 public:
  int index;
  double distance;
} dis[100005];
class B {
 public:
  int index;
  double distance;
} disa[100005];
class C {
 public:
  int index;
  double distance;
} disb[100005];
bool cmpB(B i, B j) { return i.distance < j.distance; }
bool cmpC(C i, C j) { return i.distance < j.distance; }
int main() {
  int n;
  double result = 0, xiao;
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  cin >> n;
  for (int ii = 0; ii < n; ii++) cin >> x[ii] >> y[ii];
  for (int ii = 0; ii < n; ii++) {
    dis[ii].index = ii;
    dis[ii].distance = sqrt(double(x[ii] - tx) * (x[ii] - tx) +
                            double(y[ii] - ty) * (y[ii] - ty));
    disa[ii].index = ii;
    disa[ii].distance =
        -dis[ii].distance + sqrt(double(x[ii] - ax) * (x[ii] - ax) +
                                 double(y[ii] - ay) * (y[ii] - ay));
    disb[ii].index = ii;
    disb[ii].distance =
        -dis[ii].distance + sqrt(double(x[ii] - bx) * (x[ii] - bx) +
                                 double(y[ii] - by) * (y[ii] - by));
  }
  for (int ii = 0; ii < n; ii++) result += dis[ii].distance;
  result *= 2;
  sort(disa, disa + n, cmpB);
  sort(disb, disb + n, cmpC);
  if (disa[0].index == disb[0].index) {
    val[0] = disa[0].distance;
    val[1] = disb[0].distance;
    val[2] = disa[0].distance + disb[1].distance;
    val[3] = disa[1].distance + disb[0].distance;
    sort(val, val + 4);
    result += val[0];
  } else {
    if (disa[0].distance < 0 && disb[0].distance < 0)
      result += disa[0].distance + disb[0].distance;
    else if (disa[0].distance < 0 && disb[0].distance >= 0)
      result += disa[0].distance;
    else if (disa[0].distance >= 0 && disb[0].distance < 0)
      result += disb[0].distance;
    else {
      result += disa[0].distance < disb[0].distance ? disa[0].distance
                                                    : disb[0].distance;
    }
  }
  printf("%.12f\n", result);
  return 0;
}
