#include <bits/stdc++.h>
using namespace std;
const int M = 100010;
struct node {
  int x, y;
} a[M], p[3];
int n, t, flag[M];
double ans, dis[3][M];
long long sqr(int x) { return (long long)x * x; }
int main() {
  for (int i = 2; i >= 0; i--) scanf("%d%d", &p[i].x, &p[i].y);
  scanf("%d", &n);
  double sss = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i].x, &a[i].y);
    for (int j = 0; j <= 2; j++)
      dis[j][i] = sqrt(sqr(p[j].x - a[i].x) + sqr(p[j].y - a[i].y));
    sss += dis[0][i];
  }
  sss = (double)sss * 2;
  double s1 = sss;
  double k = -1000000000000000ll;
  ans = 1000000000000000ll;
  for (int i = 1; i <= n; i++) k = max(dis[0][i] - dis[1][i], k);
  sss -= k;
  ans = min(ans, sss);
  sss += k;
  k = -1000000000000000ll;
  for (int i = 1; i <= n; i++) k = max(dis[0][i] - dis[2][i], k);
  sss -= k;
  ans = min(ans, sss);
  sss += k;
  k = -1000000000000000ll;
  for (int i = 1; i <= n; i++)
    if (k < dis[0][i] - dis[2][i]) {
      t++;
      flag[i] = t;
      k = dis[0][i] - dis[2][i];
    }
  sss -= k;
  k = -1000000000000000ll;
  for (int i = 1; i <= n; i++)
    if (k < dis[0][i] - dis[1][i] && flag[i] != t) k = dis[0][i] - dis[1][i];
  sss -= k;
  ans = min(ans, sss);
  k = -1000000000000000ll;
  sss = s1;
  for (int i = 1; i <= n; i++)
    if (k < dis[0][i] - dis[1][i]) {
      t++;
      flag[i] = t;
      k = dis[0][i] - dis[1][i];
    }
  sss -= k;
  k = -1000000000000000ll;
  for (int i = 1; i <= n; i++)
    if (k < dis[0][i] - dis[2][i] && flag[i] != t) k = dis[0][i] - dis[2][i];
  sss -= k;
  ans = min(ans, sss);
  printf("%.15lf", ans);
  return 0;
}
