#include <bits/stdc++.h>
using namespace std;
long long int M = 1e9 + 7;
long long int n, k, m;
long long int me(long long int a, long long int b, long long int M) {
  if (b == 0)
    return 1;
  else if (b % 2 == 0)
    return me((a * a) % M, b / 2, M);
  else
    return (a % M * me((a * a) % M, (b - 1) / 2, M) % M) % M;
}
long long int mI(long long int a, long long int m) { return me(a, m - 2, m); }
struct edge {
  long long int first, second, third;
};
bool cmp(pair<double, long long int> a, pair<double, long long int> b) {
  return a.first < b.first;
}
long long int a[100005];
double yy[100005];
pair<double, double> p[100005];
long double dist(long double ax, long double ay, long double bx,
                 long double by) {
  return sqrt((ax - bx) * (ax - bx) + (ay - by) * (ay - by));
}
int main() {
  double ax, ay, bx, by, lx, ly;
  cin >> ax >> ay >> bx >> by >> lx >> ly;
  vector<pair<double, long long int>> v, v1;
  cin >> n;
  double y = 0;
  for (int i = 1; i <= n; i++) {
    cin >> p[i].first >> p[i].second;
    y += 2.0 * dist(p[i].first, p[i].second, lx, ly);
    yy[i] = dist(p[i].first, p[i].second, lx, ly);
  }
  for (int i = 1; i <= n; i++) {
    double y1 = -dist(p[i].first, p[i].second, lx, ly);
    y1 += dist(p[i].first, p[i].second, ax, ay);
    double y2 = -dist(p[i].first, p[i].second, lx, ly);
    y2 += dist(p[i].first, p[i].second, bx, by);
    v.push_back(make_pair(y1, i));
    v1.push_back(make_pair(y2, i));
  }
  sort(v.begin(), v.end());
  sort(v1.begin(), v1.end());
  if (v[0].second == v1[0].second) {
    double ans = y + min(v[0].first, v1[0].first);
    double y2 = v1[0].first + y;
    double y3 = v[0].first + y;
    y2 = y2 + v[1].first;
    y3 = y3 + v1[1].first;
    printf("%0.15f", (double)min({ans, y2, y3}));
  } else {
    double ans = y + min(v[0].first, v1[0].first);
    double y2 = v[0].first + y;
    y2 = y2 + v1[0].first;
    printf("%0.15f", (double)(min(ans, y2)));
  }
}
