#include <bits/stdc++.h>
const int SZ = 1e5 + 5;
using namespace std;
struct point {
  double x, y;
};
int n;
double res;
point p1, p2, p3, p[SZ];
vector<pair<point, int> > a;
pair<double, int> mn[2][2] = {{{1e30, -1}, {1e30, -1}},
                              {{1e30, -1}, {1e30, -1}}};
double dis(long long x1, long long y1, long long x2, long long y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
void getMinDis(int j) {
  point pg;
  (j == 0) ? pg = p1 : pg = p2;
  for (int i = 0; i < n; i++) {
    double disX = dis(p[i].x, p[i].y, pg.x, pg.y);
    double disC = dis(p[i].x, p[i].y, p3.x, p3.y);
    if (disX - disC < mn[j][0].first) {
      mn[j][1] = mn[j][0];
      mn[j][0] = {disX - disC, i};
    } else if (disX - disC < mn[j][1].first) {
      mn[j][1] = {disX - disC, i};
    }
  }
}
int main() {
  scanf("%lf%lf", &p1.x, &p1.y);
  scanf("%lf%lf", &p2.x, &p2.y);
  scanf("%lf%lf", &p3.x, &p3.y);
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lf%lf", &p[i].x, &p[i].y);
    res += 2.0l * dis(p3.x, p3.y, p[i].x, p[i].y);
  }
  getMinDis(0);
  getMinDis(1);
  double ans = min(res + mn[0][0].first, res + mn[1][0].first);
  for (int i = 0; i < 2; i++)
    for (int j = 0; j < 2; j++)
      if (mn[0][i].second != mn[1][j].second)
        ans = min(ans, res + mn[0][i].first + mn[1][j].first);
  cout << fixed << setprecision(9) << ans;
}
