#include <bits/stdc++.h>
using namespace std;
template <class T>
inline T SQR(T a) {
  return ((a) * (a));
}
template <typename T>
double DIS(T a, T b) {
  return sqrt((double)(SQR(a.first - b.first) + SQR(a.second - b.second)));
}
template <typename T>
double DIS2(T a, T b) {
  return (long long)(SQR(a.first - b.first) + SQR(a.second - b.second));
}
pair<long long, long long> pp[200005 + 2];
pair<long long, long long> a, b, t;
double dis[200005 + 2];
set<pair<double, int> > St;
int main() {
  long long n, m, k, x, y;
  int i, j;
  scanf("%lld%lld", &a.first, &a.second);
  scanf("%lld%lld", &b.first, &b.second);
  scanf("%lld%lld", &t.first, &t.second);
  scanf("%lld", &n);
  double sm = 0.0;
  for (i = 1; i <= n; i++) {
    scanf("%lld%lld", &pp[i].first, &pp[i].second);
    sm += (2.0 * DIS(t, pp[i]));
  }
  double tot = sm;
  double mn = 0.0;
  for (i = 1; i <= n; i++) {
    double db = DIS(b, pp[i]);
    double dt = DIS(pp[i], t);
    St.insert(make_pair(db - dt, i));
    dis[i] = (db - dt);
    if (mn == 0.0) {
      mn = tot + dis[i];
    } else
      mn = min(mn, tot + dis[i]);
  }
  for (i = 1; i <= n; i++) {
    double da = DIS(a, pp[i]);
    double dt = DIS(t, pp[i]);
    tot = (sm + da - dt);
    mn = min(mn, tot);
  }
  for (i = 1; i <= n; i++) {
    double da = DIS(a, pp[i]);
    double dt = DIS(t, pp[i]);
    tot = (sm + da - dt);
    St.erase(make_pair(dis[i], i));
    if (!St.empty()) {
      set<pair<double, int> >::iterator it = St.begin();
      tot += (*it).first;
      mn = min(mn, tot);
    }
    St.insert(make_pair(dis[i], i));
  }
  printf("%.12lf\n", mn);
  return 0;
}
