#include <bits/stdc++.h>
using namespace std;
pair<double, double> a, b, t;
double dist(pair<double, double> x, pair<double, double> y) {
  return sqrt((x.first - y.first) * (x.first - y.first) +
              (x.second - y.second) * (x.second - y.second));
}
bool compa(pair<double, double> x, pair<double, double> y) {
  double dx = dist(a, x) - dist(x, t);
  double dy = dist(a, y) - dist(y, t);
  return dx <= dy;
}
bool compb(pair<double, double> x, pair<double, double> y) {
  double dx = dist(b, x) - dist(x, t);
  double dy = dist(b, y) - dist(y, t);
  return dx <= dy;
}
vector<pair<double, double> > va, vb;
int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int n;
  pair<double, double> pos;
  double ans = 0, sum;
  cin >> a.first >> a.second >> b.first >> b.second >> t.first >> t.second >> n;
  for (int i = 0; i < n; ++i) {
    cin >> pos.first >> pos.second;
    va.push_back(pos);
    vb.push_back(pos);
    ans += 2 * dist(pos, t);
  }
  sum = ans;
  ans = 0;
  sort(va.begin(), va.end(), compa);
  sort(vb.begin(), vb.end(), compb);
  if (va.size() == 1)
    sum = min(dist(va[0], t) + dist(a, va[0]), dist(vb[0], t) + dist(b, vb[0]));
  else {
    ans = min(dist(va[0], a) - dist(va[0], t), dist(vb[0], b) - dist(vb[0], t));
    if (va[0] != vb[0])
      ans = min(ans, dist(va[0], a) - dist(va[0], t) + dist(vb[0], b) -
                         dist(vb[0], t));
    if (va[0] != vb[1])
      ans = min(ans, dist(va[0], a) - dist(va[0], t) + dist(vb[1], b) -
                         dist(vb[1], t));
    if (va[1] != vb[0])
      ans = min(ans, dist(va[1], a) - dist(va[1], t) + dist(vb[0], b) -
                         dist(vb[0], t));
  }
  ans += sum;
  cout << fixed << setprecision(12) << ans << "\n";
  return 0;
}
