#include <bits/stdc++.h>
using namespace std;
struct data {
  long double v;
  int n;
};
long double dist(int x1, int y1, int x2, int y2) {
  long long tmp1 = pow(abs(x1 - x2), 2);
  long long tmp2 = pow(abs(y1 - y2), 2);
  long double tmp = sqrt(tmp1 + tmp2);
  return tmp;
}
int ax, ay, bx, by, tx, ty, n;
int main() {
  cout.sync_with_stdio(false);
  scanf("%d%d%d%d%d%d%d", &ax, &ay, &bx, &by, &tx, &ty, &n);
  if (n == 1) {
    int x, y;
    scanf("%d%d", &x, &y);
    long double a = dist(x, y, ax, ay);
    long double b = dist(x, y, bx, by);
    long double ans = dist(x, y, tx, ty) + (a < b ? a : b);
    cout << fixed << setprecision(12) << ans << endl;
  } else {
    long double ans = 0;
    data a1, a2, b1, b2;
    a1.v = -999999999999999.9, a2.v = -999999999999999.9;
    b1.v = -999999999999999.9, b2.v = -999999999999999.9;
    int x, y;
    long double a, b;
    for (int i = 0; i < n; i++) {
      scanf("%d%d", &x, &y);
      ans += dist(x, y, tx, ty);
      a = dist(x, y, tx, ty) - dist(x, y, ax, ay);
      b = dist(x, y, tx, ty) - dist(x, y, bx, by);
      if (a > a1.v) {
        a2.v = a1.v, a2.n = a1.n;
        a1.v = a, a1.n = i;
      } else if (a > a2.v) {
        a2.v = a, a2.n = i;
      }
      if (b > b1.v) {
        b2.v = b1.v, b2.n = b1.n;
        b1.v = b, b1.n = i;
      } else if (b > b2.v) {
        b2.v = b, b2.n = i;
      }
    }
    ans *= 2;
    if ((a1.v > 0) && (b1.v > 0)) {
      if (a1.n != b1.n) {
        ans -= a1.v + b1.v;
      } else if ((a2.v > 0) && (b2.v > 0)) {
        long double tmp1 = a1.v + b2.v, tmp2 = a2.v + b1.v;
        ans -= (tmp1 > tmp2 ? tmp1 : tmp2);
      } else if (a2.v > 0) {
        long double tmp1 = a2.v + b1.v, tmp2 = a1.v;
        ans -= (tmp1 > tmp2 ? tmp1 : tmp2);
      } else if (b2.v > 0) {
        long double tmp1 = a1.v + b2.v, tmp2 = b1.v;
        ans -= (tmp1 > tmp2 ? tmp1 : tmp2);
      } else {
        ans -= (a1.v > b1.v ? a1.v : b1.v);
      }
    } else if (a1.v > 0) {
      ans -= a1.v;
    } else if (b1.v > 0) {
      ans -= b1.v;
    } else {
      ans -= (a1.v > b1.v ? a1.v : b1.v);
    }
    cout << fixed << setprecision(12) << ans << endl;
  }
  return 0;
}
