#include <bits/stdc++.h>
using namespace std;
long long ax, ay, bx, by, tx, ty;
long double dis_t[200005], dis_a[200005], dis_b[200005];
long long x[200005], y[200005];
long long dx, dy;
int main() {
  int n;
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  cin >> n;
  for (int i = 0; i < n; i++) scanf("%I64d%I64d", &x[i], &y[i]);
  for (int i = 0; i < n; i++) {
    dx = ax - x[i];
    dy = ay - y[i];
    dis_a[i] = sqrt(dx * dx + dy * dy);
    dx = tx - x[i];
    dy = ty - y[i];
    dis_a[i] += sqrt(dx * dx + dy * dy);
  }
  for (int i = 0; i < n; i++) {
    dx = bx - x[i];
    dy = by - y[i];
    dis_b[i] = sqrt(dx * dx + dy * dy);
    dx = tx - x[i];
    dy = ty - y[i];
    dis_b[i] += sqrt(dx * dx + dy * dy);
  }
  long double sum = 0;
  for (int i = 0; i < n; i++) {
    dx = tx - x[i];
    dy = ty - y[i];
    dis_t[i] = 2 * sqrt(dx * dx + dy * dy);
    sum += dis_t[i];
  }
  long double ans = 1e17;
  for (int i = 0; i < n; i++) ans = min(ans, sum - dis_t[i] + dis_a[i]);
  for (int i = 0; i < n; i++) ans = min(ans, sum - dis_t[i] + dis_b[i]);
  if (n > 1) {
    set<pair<long double, int> > s1, s2;
    for (int i = 0; i < n; i++) s1.insert(make_pair(dis_a[i] - dis_t[i], i));
    for (int i = 0; i < n; i++) s2.insert(make_pair(dis_b[i] - dis_t[i], i));
    set<pair<long double, int> >::iterator it;
    long double aux = sum + (*s1.begin()).first;
    it = s2.begin();
    if ((*it).second == (*s1.begin()).second)
      it++, aux += (it->first);
    else
      aux += (it->first);
    ans = min(ans, aux);
    it = s1.begin();
    aux = sum + (*s2.begin()).first;
    if ((*s2.begin()).second == (*s1.begin()).second)
      it++, aux += (it->first);
    else
      aux += (it->first);
    ans = min(ans, aux);
  }
  printf("%.10lf\n", double(ans));
}
