#include <bits/stdc++.h>
using namespace std;
long double cd(long long int x1, long long int y1, long long int x2,
               long long int y2) {
  return sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}
pair<long long int, long long int> coor[100005];
int main() {
  ios_base::sync_with_stdio(false);
  long long int ax, ay, bx, by, tx, ty;
  int n;
  cin >> ax >> ay >> bx >> by >> tx >> ty >> n;
  for (int i = 0; i < n; i++) cin >> coor[i].first >> coor[i].second;
  long double adist = -100000000000007, bdist = -100000000000007,
              apdist = -100000000000007, bpdist = -100000000000007, ans = 0;
  int aind = -1, bind = -1, preva = -1, prevb = -1;
  for (int i = 0; i < n; i++) {
    long double dist = 2 * cd(tx, ty, coor[i].first, coor[i].second);
    ans += dist;
    long double tempa1 = cd(ax, ay, coor[i].first, coor[i].second) +
                         cd(tx, ty, coor[i].first, coor[i].second);
    long double tempb1 = cd(bx, by, coor[i].first, coor[i].second) +
                         cd(tx, ty, coor[i].first, coor[i].second);
    long double tempa = dist - tempa1;
    long double tempb = dist - tempb1;
    if (tempa > adist) {
      apdist = adist;
      adist = tempa;
      preva = aind;
      aind = i;
    } else if (tempa > apdist) {
      apdist = tempa;
      preva = i;
    }
    if (tempb > bdist) {
      bpdist = bdist;
      bdist = tempb;
      prevb = bind;
      bind = i;
    } else if (tempb > bpdist) {
      bpdist = tempb;
      prevb = i;
    }
  }
  if (apdist < 0) apdist = 0;
  if (bpdist < 0) bpdist = 0;
  if (adist > 0 && bdist > 0) {
    if (aind == bind) {
      if (adist + bpdist < bdist + apdist)
        ans -= bdist + apdist;
      else
        ans -= adist + bpdist;
    } else
      ans -= adist + bdist;
  } else
    ans -= max(adist, bdist);
  cout << setprecision(15) << ans << '\n';
  return 0;
}
