#include <bits/stdc++.h>
using namespace std;
const int maxn = 101000;
struct node {
  double x, y;
} a[maxn];
struct Node {
  double dis, id;
} ans1[maxn], ans2[maxn];
double dis(double x1, double x2, double x3, double x4) {
  return sqrt((x1 - x3) * (x1 - x3) + (x2 - x4) * (x2 - x4));
}
bool cmp(Node u, Node v) { return u.dis < v.dis; }
int main() {
  double x1, y1, x2, y2, x3, y3;
  scanf("%lf%lf%lf%lf%lf%lf", &x1, &y1, &x2, &y2, &x3, &y3);
  int n;
  scanf("%d", &n);
  double ans = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%lf%lf", &a[i].x, &a[i].y);
    ans = ans + dis(a[i].x, a[i].y, x3, y3) * 2.0;
    ans1[i].dis = dis(a[i].x, a[i].y, x1, y1) - dis(a[i].x, a[i].y, x3, y3);
    ans1[i].id = i;
    ans2[i].dis = dis(a[i].x, a[i].y, x2, y2) - dis(a[i].x, a[i].y, x3, y3);
    ans2[i].id = i;
  }
  sort(ans1 + 1, ans1 + n + 1, cmp);
  sort(ans2 + 1, ans2 + n + 1, cmp);
  double minv = 100000000000000000.0;
  for (int i = 0; i <= n; i++) {
    if (i == 0)
      minv = min(minv, ans2[1].dis);
    else {
      minv = min(minv, ans1[i].dis);
      if (ans2[1].id == ans1[i].id)
        minv = min(minv, ans1[i].dis + ans2[2].dis);
      else
        minv = min(minv, ans1[i].dis + ans2[1].dis);
    }
  }
  printf("%.10f\n", ans + minv);
}
