#include <bits/stdc++.h>
using namespace std;
inline bool SR(int &x) { return scanf("%d", &x) == 1; }
inline bool SR(long long &x) { return scanf("%lld", &x) == 1; }
inline bool SR(double &x) { return scanf("%lf", &x) == 1; }
inline bool SR(char *s) { return scanf("%s", s) == 1; }
inline bool RI() { return true; }
template <typename I, typename... T>
inline bool RI(I &x, T &...tail) {
  return SR(x) && RI(tail...);
}
inline void SP(const int x) { printf("%d", x); }
inline void SP(const long long x) { printf("%lld", x); }
inline void SP(const double x) { printf("%.16lf", x); }
inline void SP(const char *s) { printf("%s", s); }
inline void PL() { puts(""); }
template <typename I, typename... T>
inline void PL(const I x, const T... tail) {
  SP(x);
  if (sizeof...(tail)) putchar(' ');
  PL(tail...);
}
template <typename I>
void _DOING(const char *s, I &&x) {
  cerr << s << " = " << x << endl;
}
template <typename I, typename... T>
void _DOING(const char *s, I &&x, T &&...tail) {
  int c = 0;
  while (*s != ',' || c != 0) {
    if (*s == '(' || *s == '[' || *s == '{') c++;
    if (*s == ')' || *s == ']' || *s == '}') c--;
    cerr << *s++;
  }
  cerr << " = " << x << " , ";
  _DOING(s + 1, tail...);
}
inline int RAND() {
  static int x = 880301;
  return (x = x * 0xdefaced + 1) & 0x7fffffff;
}
const double INF = 1e30;
const int MAX_N = 100000 + 10;
struct Point {
  double x, y;
  Point(double _x = 0.0, double _y = 0.0) : x(_x), y(_y) {}
};
inline double dist(Point a, Point b) {
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
Point ps[MAX_N];
int main() {
  Point a, b, t;
  RI(a.x, a.y, b.x, b.y, t.x, t.y);
  int n;
  RI(n);
  for (int i = 0; i < int(n); i++) RI(ps[i].x, ps[i].y);
  double s = 0.0;
  vector<pair<double, int> > aps, bps;
  for (int i = 0; i < int(n); i++) {
    double dpt = dist(ps[i], t);
    double dpa = dist(ps[i], a);
    double dpb = dist(ps[i], b);
    s += 2.0 * dpt;
    aps.push_back(make_pair(dpa - dpt, i));
    bps.push_back(make_pair(dpb - dpt, i));
  }
  sort((aps).begin(), (aps).end());
  sort((bps).begin(), (bps).end());
  double ans = INF;
  if (n == 1)
    ans = s + min(aps[0].first, bps[0].first);
  else {
    if (aps[0].second != bps[0].second) {
      if (aps[0].first < bps[0].first)
        ans = s + aps[0].first + min(0.0, bps[0].first);
      else
        ans = s + min(0.0, aps[0].first) + bps[0].first;
    } else {
      if (aps[0].first < bps[1].first)
        ans = min(ans, s + aps[0].first + min(0.0, bps[1].first));
      else
        ans = min(ans, s + min(0.0, aps[0].first) + bps[1].first);
      if (aps[1].first < bps[0].first)
        ans = min(ans, s + aps[1].first + min(0.0, bps[0].first));
      else
        ans = min(ans, s + min(0.0, aps[1].first) + bps[0].first);
    }
  }
  PL(ans);
  return 0;
}
