#include <bits/stdc++.h>
using namespace std;
struct point {
  double x, y;
} p[100005];
bool vis[100005];
inline double dis(point a, point b) {
  if (a.x == b.x && a.y == b.y) return 0;
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
int main() {
  point a, b, c;
  cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y;
  int n;
  cin >> n;
  double tmp11 = 0, tmp12 = 0, tmp21 = 0, tmp22 = 0;
  double qtmp = -1e18;
  int i11, i12, i21, i22;
  double sum = 0;
  for (int i = 1; i <= n; i++) {
    cin >> p[i].x >> p[i].y;
    double tmp1 = dis(p[i], c) - dis(p[i], a);
    double tmp2 = dis(p[i], c) - dis(p[i], b);
    qtmp = max(qtmp, max(tmp1, tmp2));
    sum += 2 * dis(p[i], c);
    if (tmp1 > tmp11) {
      tmp12 = tmp11;
      tmp11 = tmp1;
      i12 = i11;
      i11 = i;
    } else if (tmp1 > tmp12) {
      tmp12 = tmp1;
      i12 = i;
    }
    if (tmp2 > tmp21) {
      tmp22 = tmp21;
      tmp21 = tmp2;
      i22 = i21;
      i21 = i;
    } else if (tmp2 > tmp22) {
      tmp22 = tmp2;
      i22 = i;
    }
  }
  double mx;
  if (i11 == i21)
    mx = max(tmp11 + tmp22, tmp12 + tmp21);
  else
    mx = tmp11 + tmp21;
  if (qtmp < 0) sum -= qtmp;
  sum -= mx;
  cout << fixed << setprecision(18) << sum << endl;
}
