#include <bits/stdc++.h>
using namespace std;
long long Set(long long N, long long pos) {
  if (pos < 0) return N;
  return N = N | (1ll << pos);
}
long long reset(long long N, long long pos) { return N = N & ~(1ll << pos); }
bool check(long long N, long long pos) {
  if (pos < 0) return 0;
  return (bool)(N & (1ll << pos));
}
void CI(long long &_x) { scanf("%d", &_x); }
void CO(long long &_x) { cout << _x; }
template <typename T>
void getarray(T a[], long long n) {
  for (long long i = 0; i < n; i++) cin >> a[i];
}
template <typename T>
void prLLIarray(T a[], long long n) {
  for (long long i = 0; i < n - 1; i++) cout << a[i] << " ";
  cout << a[n - 1] << endl;
}
const double EPS = 1e-9;
const long long INF = 0x7f7f7f7f;
long long dr8[8] = {1, -1, 0, 0, 1, -1, -1, 1};
long long dc8[8] = {0, 0, -1, 1, 1, 1, -1, -1};
long long dr4[4] = {0, 0, 1, -1};
long long dc4[4] = {-1, 1, 0, 0};
long long kn8r[8] = {1, 2, 2, 1, -1, -2, -2, -1};
long long kn8c[8] = {2, 1, -1, -2, -2, -1, 1, 2};
vector<pair<int, int> > p;
double dist(double x1, double y1, double x2, double y2) {
  double d;
  d = (x1 - x2) * (x1 - x2);
  d += (y1 - y2) * (y1 - y2);
  return sqrt(d);
}
double ar[100005];
int n;
int ax, ay, bx, by, tx, ty;
double dp[100005][2][2];
bool vis[100005][2][2];
double rec(int pos, int f, int s) {
  if (pos == n) {
    if (f == 1 || s == 1) return 0;
    return 1e18;
  }
  if (vis[pos][f][s]) return dp[pos][f][s];
  double ans = 1e18;
  ans = min(ans, ar[pos] + rec(pos + 1, f, s));
  if (f == 0) {
    double d = dist(ax, ay, p[pos].first, p[pos].second) +
               dist(p[pos].first, p[pos].second, tx, ty);
    ans = min(ans, d + rec(pos + 1, 1, s));
  }
  if (s == 0) {
    double d = dist(bx, by, p[pos].first, p[pos].second) +
               dist(p[pos].first, p[pos].second, tx, ty);
    ans = min(ans, d + rec(pos + 1, f, 1));
  }
  vis[pos][f][s] = 1;
  dp[pos][f][s] = ans;
  return ans;
}
int main() {
  memset(vis, 0, sizeof vis);
  scanf("%d %d %d %d %d %d", &ax, &ay, &bx, &by, &tx, &ty);
  scanf("%d", &n);
  double sum = 0;
  for (long long i = 0; i < n; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    p.push_back(make_pair(x, y));
    ar[i] = 2.0 * dist(tx, ty, x, y);
    sum += ar[i];
  }
  printf("%0.10lf\n", rec(0, 0, 0));
}
