#include <bits/stdc++.h>
inline long long gcd(long long a, long long b) {
  return (b ? gcd(b, a % b) : a);
}
inline long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
inline int cmp(double x, double y = 0, double tol = 1e-7) {
  return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}
using namespace std;
struct point {
  long double x, y;
  point(long double a = 0, long double b = 0) : x(a), y(b) {}
  bool operator<(const point &a) const {
    if (fabs(x - a.x) > 1e-7) return x < a.x;
    return y < a.y;
  }
  point operator+(const point &a) const { return point(x + a.x, y + a.y); }
  point operator-(const point &a) const { return point(x - a.x, y - a.y); }
  point operator/(const long double a) const { return point(x / a, y / a); }
};
double dist(point a, point b) { return hypot(a.x - b.x, a.y - b.y); }
int main() {
  std::ios::sync_with_stdio(false);
  point a, b, t;
  cin >> a.x >> a.y;
  cin >> b.x >> b.y;
  cin >> t.x >> t.y;
  int n, x, y;
  cin >> n;
  vector<point> v;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    v.push_back(point(x, y));
  }
  long double ans = 0;
  for (int i = 0; i < n; i++) {
    ans += 2 * dist(v[i], t);
  }
  vector<pair<long double, int> > v1, v2;
  for (int i = 0; i < n; i++) {
    v1.push_back(make_pair(dist(a, v[i]) - dist(v[i], t), i));
    v2.push_back(make_pair(dist(b, v[i]) - dist(v[i], t), i));
  }
  sort(v1.begin(), v1.end());
  sort(v2.begin(), v2.end());
  long double sub = min(v1[0].first, v2[0].first);
  for (int i = 0; i < 2 && i < (int)v1.size(); i++) {
    for (int j = 0; j < 2 && j < (int)v2.size(); j++) {
      if (v1[i].second != v2[j].second) {
        sub = min(sub, v1[i].first + v2[j].first);
      }
    }
  }
  cout << setprecision(15) << fixed << ans + sub << endl;
}
