#include <bits/stdc++.h>
using namespace std;
bool eq(double a, double b) { return (abs(a - b) < 1e-12); }
struct dot {
  double x, y;
};
double r(dot a, dot b) {
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
vector<pair<dot, double> > v;
vector<pair<double, int> > va;
vector<pair<double, int> > vb;
bool cmp(pair<double, int> a, pair<double, int> b) {
  return (!eq(a.first, b.first) && a.first < b.first);
}
int main() {
  ios::sync_with_stdio(false);
  dot a, b, t;
  cin >> a.x >> a.y >> b.x >> b.y >> t.x >> t.y;
  double ans = 500000000000000;
  double sum = 0;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    dot x;
    cin >> x.x >> x.y;
    v.push_back({x, r(x, t)});
    sum += 2 * r(x, t);
  }
  if (n == 1) {
    ans = min(r(a, v[0].first), r(b, v[0].first)) + v[0].second;
    cout << fixed << setprecision(14) << ans << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    double aa = r(v[i].first, a) - v[i].second;
    double bb = r(v[i].first, b) - v[i].second;
    ans = min(ans, sum + aa);
    ans = min(ans, sum + bb);
    va.push_back({aa, i});
    vb.push_back({bb, i});
  }
  sort(va.begin(), va.end(), cmp);
  sort(vb.begin(), vb.end(), cmp);
  if (va[0].second != vb[0].second) {
    ans = min(ans, sum + va[0].first + vb[0].first);
  } else {
    ans = min(ans,
              sum + min(va[0].first + vb[1].first, va[1].first + vb[0].first));
  }
  cout << fixed << setprecision(14) << ans << endl;
  return 0;
}
