#include <bits/stdc++.h>
using namespace std;
long long a_x, a_y, b_x, b_y, u_x, u_y, n, x, y;
long double distance(long long a, long long b, long long x, long long y) {
  return pow((a - x) * (a - x) + (b - y) * (b - y), 0.5);
}
int main() {
  cin >> a_x >> a_y >> b_x >> b_y >> u_x >> u_y;
  cin >> n;
  long double total = 0;
  long double min_a_1 = 1999999999, min_a_2 = 1999999999, u_a_1 = 0, u_a_2 = 0;
  int a_1_i = 0, b_1_i = 0;
  long double min_b_1 = 1999999999, min_b_2 = 1999999999, u_b_1 = 0, u_b_2 = 0;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    long double u = distance(x, y, u_x, u_y);
    total += 2 * u;
    long double a = distance(x, y, a_x, a_y);
    long double b = distance(x, y, b_x, b_y);
    if (u - a > u_a_1 - min_a_1) {
      min_a_2 = min_a_1;
      u_a_2 = u_a_1;
      min_a_1 = a;
      u_a_1 = u;
      a_1_i = i;
    } else if (u - a > u_a_2 - min_a_2) {
      min_a_2 = a;
      u_a_2 = u;
    }
    if (u - b > u_b_1 - min_b_1) {
      min_b_2 = min_b_1;
      u_b_2 = u_b_1;
      min_b_1 = b;
      u_b_1 = u;
      b_1_i = i;
    } else if (u - b > u_b_2 - min_b_2) {
      min_b_2 = b;
      u_b_2 = u;
    }
  }
  if (n == 1) {
    if (min_a_1 < min_b_1) {
      total = u_a_1 + min_a_1;
    } else {
      total = u_b_1 + min_b_1;
    }
  } else if (u_a_1 < min_a_1) {
    if (u_b_1 < min_b_1) {
      if (min_a_1 - u_a_1 < min_b_1 - u_b_1) {
        total += min_a_1 - u_a_1;
      } else {
        total += min_b_1 - u_b_1;
      }
    } else {
      total += min_b_1 - u_b_1;
    }
  } else if (u_b_1 < min_b_1) {
    total += min_a_1 - u_a_1;
  } else if (a_1_i != b_1_i) {
    total -= u_a_1 + u_b_1;
    total += min_a_1 + min_b_1;
  } else {
    long double conf1 = min_a_1 - u_a_1, conf2 = min_b_1 - u_b_1;
    if (u_b_2 > min_b_2) {
      conf1 += min_b_2 - u_b_2;
    }
    if (u_a_2 > min_a_2) {
      conf2 += min_a_2 - u_a_2;
    }
    if (conf1 < conf2) {
      total += conf1;
    } else {
      total += conf2;
    }
  }
  cout << setprecision(10) << fixed << total << endl;
  return 0;
}
