#include <bits/stdc++.h>
using namespace std;
double pi = acos(-1);
long long power(long long a, long long b) {
  long long p_res = 1;
  while (b > 0) {
    if (b % 2 == 1) {
      p_res *= a;
      b--;
    }
    a *= a;
    b /= 2;
  }
  return p_res;
}
int ax, ay, bx, by, tx, ty;
int n;
pair<int, int> cord[110000];
pair<double, int> t_d[110000];
pair<double, int> a_d[110000];
pair<double, int> b_d[110000];
bool check[110000];
void cal_distance1(int x, int y, int idx) {
  t_d[idx].second = idx;
  t_d[idx].first = sqrt(1. * (x - tx) * (x - tx) + 1. * (y - ty) * (y - ty));
}
void cal_distance2(int x, int y, int idx) {
  a_d[idx].second = idx;
  a_d[idx].first = sqrt(1. * (x - ax) * (x - ax) + 1. * (y - ay) * (y - ay));
}
void cal_distance3(int x, int y, int idx) {
  b_d[idx].second = idx;
  b_d[idx].first = sqrt(1. * (x - bx) * (x - bx) + 1. * (y - by) * (y - by));
}
int main() {
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> cord[i].first >> cord[i].second;
    cal_distance1(cord[i].first, cord[i].second, i);
    cal_distance2(cord[i].first, cord[i].second, i);
    cal_distance3(cord[i].first, cord[i].second, i);
  }
  double total1 = 0;
  for (int i = 0; i < n; i++) {
    total1 += 2 * t_d[i].first;
  }
  double a_res = -1;
  int a_idx = 0;
  for (int i = 0; i < n; i++) {
    if (a_res == -1) {
      a_res = total1 - t_d[i].first + a_d[i].first;
      continue;
    }
    double t1 = t_d[i].first;
    double a1 = a_d[i].first;
    double comp = total1 - t_d[i].first + a_d[i].first;
    if (a_res > comp) {
      a_res = comp;
      a_idx = i;
    }
  }
  double b_res = -1;
  int b_idx = 0;
  for (int i = 0; i < n; i++) {
    if (b_res == -1) {
      b_res = total1 - t_d[i].first + b_d[i].first;
      continue;
    }
    double comp = total1 - t_d[i].first + b_d[i].first;
    if (b_res > comp) {
      b_res = comp;
      b_idx = i;
    }
  }
  double ans = min(a_res, b_res);
  double aa_res = a_res;
  for (int i = 0; i < n; i++) {
    if (i == a_idx) continue;
    double comp = a_res - t_d[i].first + b_d[i].first;
    if (aa_res > comp) {
      aa_res = comp;
    }
  }
  ans = min(ans, aa_res);
  double bb_res = b_res;
  for (int i = 0; i < n; i++) {
    if (i == b_idx) continue;
    double comp = b_res - t_d[i].first + a_d[i].first;
    if (bb_res > comp) {
      bb_res = comp;
    }
  }
  ans = min(ans, bb_res);
  printf("%.8lf", ans);
  return 0;
}
