#include <bits/stdc++.h>
using namespace std;
vector<long long> x;
vector<long long> y;
long long ax, ay, bx, by, tx, ty;
vector<pair<long double, int> > a;
vector<pair<long double, int> > b;
long long sqr(long long x) { return x * x; }
long double disa(int i) {
  return (long double)sqrt(sqr(x[i] - ax) + sqr(y[i] - ay));
}
long double disb(int i) {
  return (long double)sqrt(sqr(x[i] - bx) + sqr(y[i] - by));
}
long double dist(int i) {
  return (long double)sqrt(sqr(x[i] - tx) + sqr(y[i] - ty));
}
int main() {
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  int n;
  cin >> n;
  long double ans = 0.0;
  x.assign(n + 10, -1);
  y = x;
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    ans += 2.0 * dist(i);
  }
  for (int i = 0; i < n; i++) {
    a.push_back(pair<long double, int>(disa(i) - dist(i), i));
    b.push_back(pair<long double, int>(disb(i) - dist(i), i));
  }
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  if (a[0].first > 0 || b[0].first > 0) {
    ans = ans + min(a[0].first, b[0].first);
  } else {
    if (a[0].second != b[0].second) {
      ans = ans + a[0].first + b[0].first;
    } else {
      long double temp = ans;
      ans = min(ans, temp + a[0].first + b[1].first);
      ans = min(ans, temp + a[0].first);
      ans = min(ans, temp + a[1].first + b[0].first);
      ans = min(ans, temp + b[0].first);
    }
  }
  cout << setprecision(10) << fixed << ans << endl;
  return 0;
}
