#include <bits/stdc++.h>
using namespace std;
long long int ax, ay, bx, by, tx, ty, pts[100001][2], n;
double dp[100001][2][2];
inline double call(long long int idx, long long int state1,
                   long long int state2) {
  if (idx == n) {
    if (state1 == 0 && state2 == 0) return (1e18 + 0.0);
    return 0.0;
  }
  if (dp[idx][state1][state2] != -1.0) return dp[idx][state1][state2];
  double ans1, ans2, ans3;
  ans1 = ans2 = ans3 = 1e18 + 0.0;
  if (state1 == 0)
    ans1 = min(ans1, hypot(tx - pts[idx][0], ty - pts[idx][1]) +
                         hypot(ax - pts[idx][0], ay - pts[idx][1]) +
                         call(idx + 1, 1, state2));
  if (state2 == 0)
    ans2 = min(ans2, hypot(tx - pts[idx][0], ty - pts[idx][1]) +
                         hypot(bx - pts[idx][0], by - pts[idx][1]) +
                         call(idx + 1, state1, 1));
  ans3 = min(ans3, 2 * hypot(tx - pts[idx][0], ty - pts[idx][1]) +
                       call(idx + 1, state1, state2));
  return dp[idx][state1][state2] = min(ans1, min(ans2, ans3));
}
int main() {
  cin >> ax >> ay >> bx >> by >> tx >> ty;
  cin >> n;
  for (long long int i = 0; i < n; i++) cin >> pts[i][0] >> pts[i][1];
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < n; j++) {
      for (long long int k = 0; k < n; k++) dp[i][j][k] = -1.0;
    }
  }
  cout << fixed << setprecision(6);
  cout << call(0LL, 0LL, 0LL);
  return 0;
}
