#include <bits/stdc++.h>
using namespace std;
typedef struct PAIR {
  int x, y;
  PAIR(int x = 0, int y = 0) : x(x), y(y) {}
  PAIR operator+(const PAIR b) { return PAIR(x + b.x, y + b.y); }
  PAIR operator-(const PAIR b) { return PAIR(x - b.x, y - b.y); }
  PAIR operator*(int b) { return PAIR(x * b, y * b); }
  long long operator*(const PAIR b) {
    return (long long)x * b.x + (long long)y * b.y;
  }
  PAIR operator/(int b) { return PAIR(x / b, y / b); }
  int operator&(const PAIR b) { return x * b.y - y * b.x; }
  bool operator<(const PAIR b) {
    if (x != b.x) {
      return x < b.x;
    }
    return y < b.y;
  }
  void get() { scanf("%d%d", &x, &y); }
} P;
int N;
P pt[100113], A, B, T;
pair<double, int> d[2][2];
double dis(P a, P b) { return sqrt((a - b) * (a - b)); }
int f(int x) {
  if (x < N) {
    return 0;
  }
  return 1;
}
int main() {
  A.get();
  B.get();
  T.get();
  scanf("%d", &N);
  double S = 0, p1 = 0, p2 = 0;
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      d[i][j].first = 1.5e9;
    }
  }
  for (int i = 0; i < N; i++) {
    pt[i].get();
    double d1 = dis(pt[i], T);
    double d2 = dis(pt[i], A) - d1;
    double d3 = dis(pt[i], B) - d1;
    if (d2 < d[0][0].first) {
      d[0][1] = d[0][0];
      d[0][0] = pair<double, int>(d2, i);
    } else if (d2 < d[0][1].first) {
      d[0][1] = pair<double, int>(d2, i);
    }
    if (d3 < d[1][0].first) {
      d[1][1] = d[1][0];
      d[1][0] = pair<double, int>(d3, i);
    } else if (d3 < d[1][1].first) {
      d[1][1] = pair<double, int>(d3, i);
    }
    S += d1 * 2;
  }
  double tmp = min(d[0][0].first, d[1][0].first);
  for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      if (d[0][i].second == d[1][j].second) {
        continue;
      }
      tmp = min(tmp, d[0][i].first + d[1][j].first);
    }
  }
  S += tmp;
  printf("%.12f", S);
  return 0;
}
