#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void check_min(T &a, T b) {
  if (b < a) a = b;
}
template <class T>
inline void check_max(T &a, T b) {
  if (a < b) a = b;
}
const double EPS = 1E-10;
const double PI = acos(-1.0);
inline int sgn(double x) { return x < -EPS ? -1 : x > EPS; }
struct Point {
  double x, y;
  Point() {}
  Point(double a, double b) : x(a), y(b) {}
  Point operator+(const Point &p) const { return Point(x + p.x, y + p.y); }
  Point operator-(const Point &p) const { return Point(x - p.x, y - p.y); }
  double abs() { return hypot(x, y); }
  int read() { return scanf("%lf%lf", &x, &y); }
};
int main() {
  Point a, b, t;
  a.read();
  b.read();
  t.read();
  int n;
  scanf("%d", &n);
  double ds = 0;
  vector<pair<double, int>> la, lb;
  for (int i = 0; i < int(n); ++i) {
    Point p;
    p.read();
    double l = (p - t).abs();
    ds += l * 2;
    la.emplace_back((p - a).abs() - l, i);
    lb.emplace_back((p - b).abs() - l, i);
  }
  sort((la).begin(), (la).end());
  sort((lb).begin(), (lb).end());
  double ans = 1e300;
  for (int i = 0; i < int(int((la).size())); ++i) {
    check_min(ans, ds + la[i].first);
    for (int j = 0; j < int(int((lb).size())); ++j) {
      check_min(ans, ds + lb[j].first);
      if (lb[j].second == la[i].second) continue;
      check_min(ans, ds + la[i].first + lb[j].first);
      break;
    }
  }
  printf("%.20lf\n", ans);
  return 0;
}
