#include <bits/stdc++.h>
using namespace std;
long long mod = 1e18;
int poww(int a, int b, int mod) {
  int res = 1;
  if (b < 0) b = (b % (mod - 1) + mod - 1) % (mod - 1);
  for (; b; b >>= 1, a = 1ll * a * a % mod)
    if (b & 1) res = 1ll * res * a % mod;
  return res;
}
void min_self(long long& x, long long y) { x = min(x, y); }
struct point {
  long long x, y;
};
point a[200200];
pair<double, long long> b[200200], c[200200];
long long n;
double dis(point a, point b) {
  return sqrt((b.x - a.x) * (b.x - a.x) + (b.y - a.y) * (b.y - a.y));
}
bool cmp(pair<double, long long> a1, pair<double, long long> a2) {
  return (a1.first < a2.first);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  point p1, p2, p0;
  cin >> p1.x >> p1.y >> p2.x >> p2.y >> p0.x >> p0.y;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i].x >> a[i].y;
  }
  for (int i = 0; i < n; i++) {
    b[i].first = dis(p1, a[i]) - dis(p0, a[i]);
    c[i].first = dis(p2, a[i]) - dis(p0, a[i]);
    b[i].second = i;
    c[i].second = i;
  }
  sort(b, b + n, cmp);
  sort(c, c + n, cmp);
  double Ans = 0;
  long long po1 = b[0].second;
  long long po2 = c[0].second;
  Ans += b[0].first + c[0].first;
  if (po2 == po1) {
    Ans = min(b[0].first + c[1].first, b[1].first + c[0].first);
  }
  Ans = min(Ans, b[0].first);
  Ans = min(Ans, c[0].first);
  for (int i = 0; i < n; i++) {
    Ans += 2 * dis(p0, a[i]);
  }
  cout << fixed << setprecision(12) << Ans << '\n';
  return 0;
}
