#include <bits/stdc++.h>
using namespace std;
struct bottle {
  int number;
  double len;
  double lento;
  double diflen;
} a[100005], b[100005];
int cmp(bottle a, bottle b) {
  if (a.diflen > b.diflen) return 1;
  return 0;
}
int main() {
  double x1, y1, x2, y2, c1, c2, x, y;
  scanf("%lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &c1, &c2);
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lf %lf", &x, &y);
    a[i].len = sqrt(pow(x1 - x, 2) + pow(y1 - y, 2));
    b[i].len = sqrt(pow(x2 - x, 2) + pow(y2 - y, 2));
    a[i].lento = sqrt(pow(x - c1, 2) + pow(y - c2, 2));
    b[i].lento = sqrt(pow(x - c1, 2) + pow(y - c2, 2));
    a[i].diflen = a[i].lento - a[i].len;
    b[i].diflen = b[i].lento - b[i].len;
    a[i].number = i;
    b[i].number = i;
  }
  sort(a, a + n, cmp);
  sort(b, b + n, cmp);
  double length = a[0].len + b[0].len + a[0].lento + b[0].lento;
  int mark1 = a[0].number, mark2 = b[0].number;
  if (a[0].diflen < 0 || b[0].diflen < 0) {
    if (a[0].diflen > b[0].diflen) {
      mark2 = -1;
      length = a[0].len + a[0].lento;
    } else {
      mark1 = -1;
      length = b[0].len + b[0].lento;
    }
  }
  if (a[0].number == b[0].number && mark1 != -1 && mark2 != -1) {
    if (a[1].diflen < 0 || b[1].diflen < 0) {
      if (a[1].diflen < 0 && b[1].diflen < 0) {
        if (a[0].diflen > b[0].diflen) {
          mark2 = -1;
          mark1 = a[0].number;
          length = a[0].len + a[0].lento;
        } else {
          mark1 = -1;
          mark2 = b[0].number;
          length = b[0].len + b[0].lento;
        }
      } else if (a[1].diflen < 0) {
        if ((a[0].diflen + b[1].diflen) > b[0].diflen) {
          mark1 = a[0].number;
          mark2 = b[1].number;
          length = a[0].len + b[1].len + a[0].lento + b[1].lento;
        } else {
          mark1 = -1;
          mark2 = b[0].number;
          length = b[0].len + b[0].lento;
        }
      } else if (b[1].diflen < 0) {
        if ((b[0].diflen + a[1].diflen) > a[0].diflen) {
          mark1 = a[1].number;
          mark2 = b[0].number;
          length = a[1].len + b[0].len + a[1].lento + b[0].lento;
        } else {
          mark1 = a[0].number;
          mark2 = -1;
          length = a[0].len + a[0].lento;
        }
      }
    } else if ((a[0].diflen + b[1].diflen) > (a[1].diflen + b[0].diflen)) {
      length = a[0].len + b[1].len + a[0].lento + b[1].lento;
      mark1 = a[0].number;
      mark2 = b[1].number;
    } else {
      length = a[1].len + b[0].len + a[1].lento + b[0].lento;
      mark1 = a[1].number;
      mark2 = b[0].number;
    }
  }
  for (int i = 0; i < n; i++) {
    if (a[i].number != mark1 && a[i].number != mark2) {
      length += a[i].lento * 2;
    }
  }
  printf("%.12lf\n", length);
}
