#include <bits/stdc++.h>
using namespace std;
const double INF = 1e18;
inline long long sqr(int x) { return (long long)x * x; }
inline double dist(int x1, int y1, int x2, int y2) {
  return sqrt(sqr(x2 - x1) + sqr(y2 - y1));
}
int main() {
  int ax, ay, bx, by, tx, ty;
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  int n;
  cin >> n;
  vector<pair<int, int> > pts(n);
  for (int i = 0; i < n; ++i) {
    cin >> pts[i].first >> pts[i].second;
  }
  double d = 0;
  pair<double, int> minA(INF, -1);
  pair<double, int> secondMinA(INF, -1);
  pair<double, int> minB(INF, -1);
  pair<double, int> secondMinB(INF, -1);
  for (int i = 0; i < n; ++i) {
    d += 2.0 * dist(tx, ty, pts[i].first, pts[i].second);
    pair<double, int> curA(dist(ax, ay, pts[i].first, pts[i].second) -
                               dist(tx, ty, pts[i].first, pts[i].second),
                           i);
    if (curA < minA) {
      secondMinA = minA;
      minA = curA;
    } else if (curA < secondMinA) {
      secondMinA = curA;
    }
    pair<double, int> curB(dist(bx, by, pts[i].first, pts[i].second) -
                               dist(tx, ty, pts[i].first, pts[i].second),
                           i);
    if (curB < minB) {
      secondMinB = minB;
      minB = curB;
    } else if (curB < secondMinB) {
      secondMinB = curB;
    }
  }
  cerr << d << endl;
  double ans = INF;
  ans = min(ans, d + minA.first);
  cerr << ans << endl;
  ans = min(ans, d + minB.first);
  cerr << ans << endl;
  if (minA.second != minB.second) {
    ans = min(ans, d + minA.first + minB.first);
  } else if (n > 1) {
    ans = min(ans, d + minA.first + secondMinB.first);
    ans = min(ans, d + secondMinA.first + minB.first);
  }
  cout << setprecision(15) << fixed << ans << '\n';
  return 0;
}
