#include <bits/stdc++.h>
using namespace std;
const int N = (int)5e5 + 4;
const int inf = (int)1e9 + 7;
const long double eps = 1e-7;
const int K = 21;
const int M = 1001;
struct point {
  int x, y;
  point() {}
  ~point() {}
  point(int x, int y) : x(x), y(y) {}
  point operator+(const point &a) const { return point(x + a.x, y + a.y); }
  point operator-(const point &a) const { return point(x - a.x, y - a.y); }
  long double length() const { return sqrt(1.0 * x * x + 1.0 * y * y); }
};
point a[N];
int main() {
  point A, B, T;
  cin >> A.x >> A.y >> B.x >> B.y >> T.x >> T.y;
  int n;
  cin >> n;
  long double ans = 1e18;
  long double s = 0.0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i].x >> a[i].y;
    s += 2 * (a[i] - T).length();
  }
  long double minA1 = 1e18, minA2 = 1e18, minB1 = 1e18, minB2 = 1e18;
  int xA1 = -1, xA2 = -1, xB1 = -1, xB2 = -1;
  for (int i = 0; i < n; ++i) {
    ans = min(ans, s - (a[i] - T).length() + (a[i] - A).length());
    if (minA1 > s - (a[i] - T).length() + (a[i] - A).length()) {
      minA2 = minA1;
      xA2 = xA1;
      minA1 = s - (a[i] - T).length() + (a[i] - A).length();
      xA1 = i;
    } else {
      if (minA2 > s - (a[i] - T).length() + (a[i] - A).length()) {
        minA2 = s - (a[i] - T).length() + (a[i] - A).length();
        xA2 = i;
      }
    }
    ans = min(ans, s - (a[i] - T).length() + (a[i] - B).length());
    if (minB1 > s - (a[i] - T).length() + (a[i] - B).length()) {
      minB2 = minB1;
      xB2 = xB1;
      minB1 = s - (a[i] - T).length() + (a[i] - B).length();
      xB1 = i;
    } else {
      if (minB2 > s - (a[i] - T).length() + (a[i] - B).length()) {
        minB2 = s - (a[i] - T).length() + (a[i] - B).length();
        xB2 = i;
      }
    }
  }
  if (xA1 != xB1) {
    ans = min(ans, s - (a[xA1] - T).length() + (a[xA1] - A).length() -
                       (a[xB1] - T).length() + (a[xB1] - B).length());
  }
  if (xA1 == xB1 && n > 1) {
    ans = min(ans, min(s - (a[xA1] - T).length() + (a[xA1] - A).length() -
                           (a[xB2] - T).length() + (a[xB2] - B).length(),
                       s - (a[xA2] - T).length() + (a[xA2] - A).length() -
                           (a[xB1] - T).length() + (a[xB1] - B).length()));
  }
  printf("%.7lf", (double)ans);
  return 0;
}
