#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int mod = 1e9 + 7;
struct point {
  int x, y;
} a[N], F, S, in;
int n;
long double ans, second, c[N], first[2][N], pref[N], suf[N];
long long sq(int x) { return 1ll * x * x; }
long double dist(point a, point b) {
  return sqrt(1.0 * sq(a.x - b.x) + 1.0 * sq(a.y - b.y));
}
int main() {
  scanf("%d%d%d%d%d%d", &F.x, &F.y, &S.x, &S.y, &in.x, &in.y);
  scanf("%d", &n);
  ans = 1e100;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i].x, &a[i].y);
    second += 2.0 * dist(in, a[i]);
    pref[i] = min(pref[i - 1], dist(S, a[i]) - dist(in, a[i]));
  }
  for (int i = 1; i <= n; i++)
    ans = min(ans, second + dist(S, a[i]) - dist(in, a[i]));
  for (int i = n; i; i--)
    suf[i] = min(suf[i + 1], dist(S, a[i]) - dist(in, a[i]));
  for (int i = 1; i <= n; i++) {
    ans = min(ans, second + min(pref[i - 1], suf[i + 1]) + dist(F, a[i]) -
                       dist(in, a[i]));
  }
  cout << fixed << setprecision(10) << ans;
  return 0;
}
