/***********************************************************************/
#include <bits/stdc++.h>

#define endl ('\n')

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> point;

template<class T1, class T2>
istream& operator>>(istream& in, pair<T1,T2>& p) {
  return in >> p.first >> p.second;
}

template<class T1, class T2>
ostream& operator<<(ostream& out, pair<T1,T2> const& p) {
  return out << p.first << ' ' << p.second;
}

template<class T> void scan(T& x){cin >> x;}

template<class T, class... Args>void scan(T& x, Args& ...abc){
  cin >> x; scan(abc...);
}

template<class T>void put(T const& x){cout << x;}
template<class T>void putln(T const& x){cout << x << endl;}

template<class T, class... Args>void put(T const& x, Args const& ...abc) {
  cout << x << ' '; put(abc...);
}

template<class T, class... Args>
void putln(T const& x, Args const& ...abc) {
  cout << x << endl; putln(abc...);
}

struct _ {
 _ () {
  ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);cerr.tie(0);
  cout << fixed << setprecision(12);
  #ifndef ONLINE_JUDGE
  freopen("in", "r", stdin);
  #endif
  }
} _;

/***********************************************************************/

double dist(point const& a, point const& b) {
  double dx = a.first - b.first;
  double dy = a.second - b.second;
  return hypot(dx, dy);
}

int main() {
  int n;
  point adil, bera, bin;
  scan(adil, bera, bin, n);
  vector<point> points(n);
  for_each(points.begin(), points.end(), [](point& p){scan(p);});

  vector<double> distances(n);
  transform(points.begin(), points.end(), distances.begin(), [&bin](point const&p){
    return dist(p, bin);
  });

  double total = 2.0*accumulate(distances.begin(), distances.end(), 0.0, plus<double>());

  // <delta,index>
  vector<pair<double,int>> adil_indices(n);
  vector<pair<double,int>> bera_indices(n);

  for(int i = 0; i < n; ++i) {
    double a = dist(adil, points[i]);
    double b = dist(bera, points[i]);

    adil_indices[i] = {a - distances[i], i};
    bera_indices[i] = {b - distances[i], i};
  }

  sort(adil_indices.begin(), adil_indices.end());
  sort(bera_indices.begin(), bera_indices.end());

  double smallest = 2e9;
  smallest = min(smallest, adil_indices[0].first);
  smallest = min(smallest, bera_indices[0].first);

  if(adil_indices[0].second != bera_indices[0].second) {
    smallest = min(smallest, adil_indices[0].first + bera_indices[0].first);
  } else if(n > 1) {
    smallest = min(smallest, adil_indices[1].first + bera_indices[0].first);
    smallest = min(smallest, adil_indices[0].first + bera_indices[1].first);
  }

  putln(total + smallest);
}


/***********************************************************************/
#include <bits/stdc++.h>

#define endl ('\n')

using namespace std;

istream& operator>>(istream& in, pair<int,int>& p) {
  return in >> p.first >> p.second;
}

ostream& operator<<(ostream& out, pair<int,int> const& p) {
  return out << p.first << ' ' << p.second;
}

template<class T>
void scan(T& x) {
  cin >> x;
}

template<class T, class... Args>
void scan(T& x, Args& ...abc) {
  cin >> x;
  scan(abc...);
}

template<class T>
void put(T const& x) {
  cout << x;
}

template<class T, class... Args>
void put(T const& x, Args const& ...abc) {
  cout << x << ' ';
  put(abc...);
}

template<class T>
void putln(T const& x) {
  cout << x << endl;
}

template<class T, class... Args>
void putln(T const& x, Args const& ...abc) {
  cout << x << endl;
  putln(abc...);
}

struct _ {
 _ () {
  ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);cerr.tie(0);
  cout << fixed << setprecision(12);
  #ifndef ONLINE_JUDGE
  freopen("in", "r", stdin);
  #endif
  }
} _;

#define double long double

typedef long long ll;
typedef pair<int,int> point;

/***********************************************************************/

double dist(point const& a, point const& b) {
  double dx = a.first - b.first;
  double dy = a.second - b.second;
  return sqrt(dx*dx + dy*dy);
}

int main() {
  int n;
  point adil, bera, bin;
  scan(adil, bera, bin, n);
  vector<point> points(n);
  for_each(points.begin(), points.end(), [](point& p){scan(p);});

  vector<double> distances(n);
  transform(points.begin(), points.end(), distances.begin(), [&bin](point const&p){
    return dist(p, bin);
  });

  double total = 2*accumulate(distances.begin(), distances.end(), 0.0, plus<double>());

  // <delta,index>
  vector<pair<double,int>> adil_indices;
  vector<pair<double,int>> bera_indices;
  adil_indices.reserve(n+1);
  bera_indices.reserve(n+1);

  for(int i = 0; i < n; ++i) {
    auto a = dist(adil, points[i]);
    auto b = dist(bera, points[i]);

    adil_indices.push_back({a - distances[i], i});
    bera_indices.push_back({b - distances[i], i});
  }
  adil_indices.push_back({0, n});
  bera_indices.push_back({0, n+1});

  sort(adil_indices.begin(), adil_indices.end());
  sort(bera_indices.begin(), bera_indices.end());

  double smallest = 0.0;
  smallest = min(smallest, adil_indices[0].first);
  smallest = min(smallest, bera_indices[0].first);
  if(adil_indices[0].second != bera_indices[0].second) {
    smallest = min(adil_indices[0].first + bera_indices[0].first, smallest);
  } else {
    smallest = min(adil_indices[1].first + bera_indices[0].first, smallest);
    smallest = min(adil_indices[0].first + bera_indices[1].first, smallest);
    smallest = min(adil_indices[1].first + bera_indices[1].first, smallest);
  }

  putln(total + smallest);
}


/***********************************************************************/
#include <bits/stdc++.h>

#define endl ('\n')

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> point;

template<class T1, class T2>
istream& operator>>(istream& in, pair<T1,T2>& p) {
  return in >> p.first >> p.second;
}

template<class T1, class T2>
ostream& operator<<(ostream& out, pair<T1,T2> const& p) {
  return out << p.first << ' ' << p.second;
}

template<class T> void scan(T& x){cin >> x;}

template<class T, class... Args>void scan(T& x, Args& ...abc){
  cin >> x; scan(abc...);
}

template<class T>void put(T const& x){cout << x;}
template<class T>void putln(T const& x){cout << x << endl;}

template<class T, class... Args>void put(T const& x, Args const& ...abc) {
  cout << x << ' '; put(abc...);
}

template<class T, class... Args>
void putln(T const& x, Args const& ...abc) {
  cout << x << endl; putln(abc...);
}

struct _ {
 _ () {
  ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);cerr.tie(0);
  cout << fixed << setprecision(12);
  #ifndef ONLINE_JUDGE
  freopen("in", "r", stdin);
  #endif
  }
} _;

/***********************************************************************/

double dist(point const& a, point const& b) {
  double dx = a.first - b.first;
  double dy = a.second - b.second;
  return hypot(dx, dy);
}

int main() {
  int n;
  point adil, bera, bin;
  scan(adil, bera, bin, n);
  vector<point> points(n);
  for_each(points.begin(), points.end(), [](point& p){scan(p);});

  vector<double> distances(n);
  transform(points.begin(), points.end(), distances.begin(), [&bin](point const&p){
    return dist(p, bin);
  });

  double total = 2.0*accumulate(distances.begin(), distances.end(), 0.0, plus<double>());

  // <delta,index>
  vector<pair<double,int>> adil_indices;
  vector<pair<double,int>> bera_indices;
  adil_indices.reserve(n);
  bera_indices.reserve(n);

  for(int i = 0; i < n; ++i) {
    double a = dist(adil, points[i]);
    double b = dist(bera, points[i]);

    adil_indices.emplace_back(make_pair(a - distances[i], i));
    bera_indices.emplace_back(make_pair(b - distances[i], i));
  }

  sort(adil_indices.begin(), adil_indices.end());
  sort(bera_indices.begin(), bera_indices.end());

  double smallest = 2e9;
  smallest = min(smallest, adil_indices[0].first);
  smallest = min(smallest, bera_indices[0].first);

  if(adil_indices[0].second != bera_indices[0].second) {
    smallest = min(smallest, adil_indices[0].first + bera_indices[0].first);
  } else if(n > 1) {
    smallest = min(smallest, adil_indices[1].first + bera_indices[0].first);
    smallest = min(smallest, adil_indices[0].first + bera_indices[1].first);
  }

  putln(total + smallest);
}


/***********************************************************************/
#include <bits/stdc++.h>

#define endl ('\n')

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> point;

template<class T1, class T2>
istream& operator>>(istream& in, pair<T1,T2>& p) {
  return in >> p.first >> p.second;
}

template<class T1, class T2>
ostream& operator<<(ostream& out, pair<T1,T2> const& p) {
  return out << p.first << ' ' << p.second;
}

template<class T> void scan(T& x){cin >> x;}

template<class T, class... Args>void scan(T& x, Args& ...abc){
  cin >> x; scan(abc...);
}

template<class T>void put(T const& x){cout << x;}
template<class T>void putln(T const& x){cout << x << endl;}

template<class T, class... Args>void put(T const& x, Args const& ...abc) {
  cout << x << ' '; put(abc...);
}

template<class T, class... Args>
void putln(T const& x, Args const& ...abc) {
  cout << x << endl; putln(abc...);
}

struct _ {
 _ () {
  ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);cerr.tie(0);
  cout << fixed << setprecision(12);
  #ifndef ONLINE_JUDGE
  freopen("in", "r", stdin);
  #endif
  }
} _;

/***********************************************************************/

double dist(point const& a, point const& b) {
  double dx = a.first - b.first;
  double dy = a.second - b.second;
  return hypot(dx, dy);
}

int main() {
  int n;
  point adil, bera, bin;
  scan(adil, bera, bin, n);
  vector<point> points;
  points.reserve(n);
  for(int i = 0; i < n; ++i) {
    point x;
    scan(x);
    points.emplace_back(x);
  }

  vector<double> distances;
  distances.reserve(n);
  transform(points.begin(), points.end(), back_inserter(distances), [&bin](point const&p){
    return dist(p, bin);
  });

  double total = 2.0*accumulate(distances.begin(), distances.end(), 0.0, plus<double>());

  // <delta,index>
  vector<pair<double,int>> adil_indices;
  vector<pair<double,int>> bera_indices;
  adil_indices.reserve(n);
  bera_indices.reserve(n);

  for(int i = 0; i < n; ++i) {
    double a = dist(adil, points[i]);
    double b = dist(bera, points[i]);

    adil_indices.emplace_back(make_pair(a - distances[i], i));
    bera_indices.emplace_back(make_pair(b - distances[i], i));
  }

  sort(adil_indices.begin(), adil_indices.end());
  sort(bera_indices.begin(), bera_indices.end());

  double smallest = 2e9;
  smallest = min(smallest, adil_indices[0].first);
  smallest = min(smallest, bera_indices[0].first);

  if(adil_indices[0].second != bera_indices[0].second) {
    smallest = min(smallest, adil_indices[0].first + bera_indices[0].first);
  } else if(n > 1) {
    smallest = min(smallest, adil_indices[1].first + bera_indices[0].first);
    smallest = min(smallest, adil_indices[0].first + bera_indices[1].first);
  }

  putln(total + smallest);
}


/***********************************************************************/
#include <bits/stdc++.h>

#define endl ('\n')

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> point;

template<class T1, class T2>
istream& operator>>(istream& in, pair<T1,T2>& p) {
  return in >> p.first >> p.second;
}

template<class T1, class T2>
ostream& operator<<(ostream& out, pair<T1,T2> const& p) {
  return out << p.first << ' ' << p.second;
}

template<class T> void scan(T& x){cin >> x;}

template<class T, class... Args>void scan(T& x, Args& ...abc){
  cin >> x; scan(abc...);
}

template<class T>void put(T const& x){cout << x;}
template<class T>void putln(T const& x){cout << x << endl;}

template<class T, class... Args>void put(T const& x, Args const& ...abc) {
  cout << x << ' '; put(abc...);
}

template<class T, class... Args>
void putln(T const& x, Args const& ...abc) {
  cout << x << endl; putln(abc...);
}

struct _ {
 _ () {
  ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);cerr.tie(0);
  cout << fixed << setprecision(12);
  #ifndef ONLINE_JUDGE
  freopen("in", "r", stdin);
  #endif
  }
} _;

/***********************************************************************/

double dist(point const& a, point const& b) {
  double dx = a.first - b.first;
  double dy = a.second - b.second;
  return hypot(dx, dy);
}

int main() {
  int n;
  point adil, bera, bin;
  scan(adil, bera, bin, n);
  vector<point> points(n);
  for_each(points.begin(), points.end(), [](point& p){scan(p);});

  vector<double> distances;
  distances.reserve(n);
  transform(points.begin(), points.end(), back_inserter(distances), [&bin](point const&p){
    return dist(p, bin);
  });

  double total = 2.0*accumulate(distances.begin(), distances.end(), 0.0, plus<double>());

  // <delta,index>
  vector<pair<double,int>> adil_indices;
  vector<pair<double,int>> bera_indices;
  adil_indices.reserve(n);
  bera_indices.reserve(n);

  for(int i = 0; i < n; ++i) {
    double a = dist(adil, points[i]);
    double b = dist(bera, points[i]);

    adil_indices.emplace_back(make_pair(a - distances[i], i));
    bera_indices.emplace_back(make_pair(b - distances[i], i));
  }

  sort(adil_indices.begin(), adil_indices.end());
  sort(bera_indices.begin(), bera_indices.end());

  double smallest = 2e9;
  smallest = min(smallest, adil_indices[0].first);
  smallest = min(smallest, bera_indices[0].first);

  if(adil_indices[0].second != bera_indices[0].second) {
    smallest = min(smallest, adil_indices[0].first + bera_indices[0].first);
  } else if(n > 1) {
    smallest = min(smallest, adil_indices[1].first + bera_indices[0].first);
    smallest = min(smallest, adil_indices[0].first + bera_indices[1].first);
  }

  putln(total + smallest);
}


/***********************************************************************/
#include <bits/stdc++.h>

#define endl ('\n')

using namespace std;

istream& operator>>(istream& in, pair<int,int>& p) {
  return in >> p.first >> p.second;
}

ostream& operator<<(ostream& out, pair<int,int> const& p) {
  return out << p.first << ' ' << p.second;
}

template<class T>
void scan(T& x) {
  cin >> x;
}

template<class T, class... Args>
void scan(T& x, Args& ...abc) {
  cin >> x;
  scan(abc...);
}

template<class T>
void put(T const& x) {
  cout << x;
}

template<class T, class... Args>
void put(T const& x, Args const& ...abc) {
  cout << x << ' ';
  put(abc...);
}

template<class T>
void putln(T const& x) {
  cout << x << endl;
}

template<class T, class... Args>
void putln(T const& x, Args const& ...abc) {
  cout << x << endl;
  putln(abc...);
}

struct _ {
 _ () {
  ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);cerr.tie(0);
  cout << fixed << setprecision(10);
  #ifndef ONLINE_JUDGE
  freopen("in", "r", stdin);
  #endif
  }
} _;

typedef long long ll;
typedef pair<int,int> point;

/***********************************************************************/

double dist(point const& a, point const& b) {
  double dx = a.first - b.first;
  double dy = a.second - b.second;
  return sqrt(dx*dx + dy*dy);
}

int main() {
  int n;
  point adil, bera, bin;
  scan(adil, bera, bin, n);
  vector<point> points(n);
  for_each(points.begin(), points.end(), [](point& p){scan(p);});

  vector<double> distances(n);
  transform(points.begin(), points.end(), distances.begin(), [&bin](point const&p){
    return dist(p, bin);
  });

  double total = 2*accumulate(distances.begin(), distances.end(), 0.0, plus<double>());

  // <delta,index>
  vector<pair<double,int>> adil_indices;
  vector<pair<double,int>> bera_indices;
  adil_indices.reserve(n+1);
  bera_indices.reserve(n+1);

  for(int i = 0; i < n; ++i) {
    auto a = dist(adil, points[i]);
    auto b = dist(bera, points[i]);

    adil_indices.push_back({a - distances[i], i});
    bera_indices.push_back({b - distances[i], i});
  }

  sort(adil_indices.begin(), adil_indices.end());
  sort(bera_indices.begin(), bera_indices.end());

  double smallest = 0.0;
  if(adil_indices[0].second != bera_indices[0].second)
    smallest = min(min(smallest, min(adil_indices[0].first, bera_indices[0].first)), adil_indices[0].first + bera_indices[0].first);
  else {
    smallest = min(min(smallest, min(adil_indices[0].first, bera_indices[1].first)), adil_indices[1].first + bera_indices[0].first);
    smallest = min(min(smallest, min(adil_indices[1].first, bera_indices[0].first)), adil_indices[0].first + bera_indices[1].first);
  }

  putln(total + smallest);
}


/***********************************************************************/
#include <bits/stdc++.h>

#define endl ('\n')

using namespace std;

istream& operator>>(istream& in, pair<int,int>& p) {
  return in >> p.first >> p.second;
}

ostream& operator<<(ostream& out, pair<int,int> const& p) {
  return out << p.first << ' ' << p.second;
}

template<class T>
void scan(T& x) {
  cin >> x;
}

template<class T, class... Args>
void scan(T& x, Args& ...abc) {
  cin >> x;
  scan(abc...);
}

template<class T>
void put(T const& x) {
  cout << x;
}

template<class T, class... Args>
void put(T const& x, Args const& ...abc) {
  cout << x << ' ';
  put(abc...);
}

template<class T>
void putln(T const& x) {
  cout << x << endl;
}

template<class T, class... Args>
void putln(T const& x, Args const& ...abc) {
  cout << x << endl;
  putln(abc...);
}

struct _ {
 _ () {
  ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);cerr.tie(0);
  cout << fixed << setprecision(12);
  #ifndef ONLINE_JUDGE
  freopen("in", "r", stdin);
  #endif
  }
} _;

typedef long long ll;
typedef pair<int,int> point;

/***********************************************************************/

double dist(point const& a, point const& b) {
  double dx = a.first - b.first;
  double dy = a.second - b.second;
  return sqrt(dx*dx + dy*dy);
}

int main() {
  int n;
  point adil, bera, bin;
  scan(adil, bera, bin, n);
  vector<point> points(n);
  for_each(points.begin(), points.end(), [](point& p){scan(p);});

  vector<double> distances(n);
  transform(points.begin(), points.end(), distances.begin(), [&bin](point const&p){
    return dist(p, bin);
  });

  double total = 2*accumulate(distances.begin(), distances.end(), 0.0, plus<double>());

  // <delta,index>
  vector<pair<double,int>> adil_indices;
  vector<pair<double,int>> bera_indices;
  adil_indices.reserve(n+1);
  bera_indices.reserve(n+1);

  for(int i = 0; i < n; ++i) {
    auto a = dist(adil, points[i]);
    auto b = dist(bera, points[i]);

    adil_indices.push_back({a - distances[i], i});
    bera_indices.push_back({b - distances[i], i});
  }
  adil_indices.push_back({0, n});
  bera_indices.push_back({0, n+1});

  sort(adil_indices.begin(), adil_indices.end());
  sort(bera_indices.begin(), bera_indices.end());

  double smallest = 0.0;
  smallest = min(smallest, adil_indices[0].first);
  smallest = min(smallest, bera_indices[0].first);

  if(adil_indices[0].second != bera_indices[0].second) {
    smallest = min(smallest, adil_indices[0].first + bera_indices[0].first);
  } else {
    smallest = min(smallest, adil_indices[1].first + bera_indices[0].first);
    smallest = min(smallest, adil_indices[0].first + bera_indices[1].first);
  }

  putln(total + min(0.0, smallest));
}


/***********************************************************************/
#include <bits/stdc++.h>

#define endl ('\n')

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> point;

template<class T1, class T2>
istream& operator>>(istream& in, pair<T1,T2>& p) {
  return in >> p.first >> p.second;
}

template<class T1, class T2>
ostream& operator<<(ostream& out, pair<T1,T2> const& p) {
  return out << p.first << ' ' << p.second;
}

template<class T> void scan(T& x){
  cin >> x;
}

template<class T, class... Args>void scan(T& x, Args& ...abc){
  cin >> x;
  scan(abc...);
}

template<class T>void put(T const& x){cout << x;}
template<class T>void putln(T const& x){cout << x << endl;}

template<class T, class... Args>void put(T const& x, Args const& ...abc) {
  cout << x << ' '; put(abc...);
}

template<class T, class... Args>
void putln(T const& x, Args const& ...abc) {
  cout << x << endl; putln(abc...);
}

struct _ {
 _ () {
  //ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);cerr.tie(0);
  cout << fixed << setprecision(12);
  #ifndef ONLINE_JUDGE
  freopen("in", "r", stdin);
  #endif
  }
} _;

/***********************************************************************/

double dist(point const& a, point const& b) {
  double dx = a.first - b.first;
  double dy = a.second - b.second;
  return hypot(dx, dy);
}

int main() {
  int n;
  point adil, bera, bin;
  scan(adil, bera, bin, n);
  vector<point> points(n);
  for_each(points.begin(), points.end(), [](point& p){scan(p);});

  vector<double> distances(n);
  transform(points.begin(), points.end(), distances.begin(), [&bin](point const&p){
    return dist(p, bin);
  });

  double total = 2.0*accumulate(distances.begin(), distances.end(), 0.0, plus<double>());

  // <delta,index>
  vector<pair<double,int>> adil_indices(n);
  vector<pair<double,int>> bera_indices(n);

  for(int i = 0; i < n; ++i) {
    double a = dist(adil, points[i]);
    double b = dist(bera, points[i]);

    adil_indices[i] = {a - distances[i], i};
    bera_indices[i] = {b - distances[i], i};
  }

  sort(adil_indices.begin(), adil_indices.end());
  sort(bera_indices.begin(), bera_indices.end());

  double smallest = 2e9;
  smallest = min(smallest, adil_indices[0].first);
  smallest = min(smallest, bera_indices[0].first);

  if(adil_indices[0].second != bera_indices[0].second) {
    smallest = min(smallest, adil_indices[0].first + bera_indices[0].first);
  } else if(n > 1) {
    smallest = min(smallest, adil_indices[1].first + bera_indices[0].first);
    smallest = min(smallest, adil_indices[0].first + bera_indices[1].first);
  }

  putln(total + smallest);
}


/***********************************************************************/
#include <bits/stdc++.h>

#define endl ('\n')

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> point;

template<class T1, class T2>
istream& operator>>(istream& in, pair<T1,T2>& p) {
  return in >> p.first >> p.second;
}

template<class T1, class T2>
ostream& operator<<(ostream& out, pair<T1,T2> const& p) {
  return out << p.first << ' ' << p.second;
}

template<class T> void scan(T& x){cin >> x;}

template<class T, class... Args>void scan(T& x, Args& ...abc){
  cin >> x; scan(abc...);
}

template<class T>void put(T const& x){cout << x;}
template<class T>void putln(T const& x){cout << x << endl;}

template<class T, class... Args>void put(T const& x, Args const& ...abc) {
  cout << x << ' '; put(abc...);
}

template<class T, class... Args>
void putln(T const& x, Args const& ...abc) {
  cout << x << endl; putln(abc...);
}

struct _ {
 _ () {
  ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);cerr.tie(0);
  cout << fixed << setprecision(12);
  #ifndef ONLINE_JUDGE
  freopen("in", "r", stdin);
  #endif
  }
} _;

/***********************************************************************/

double dist(point const& a, point const& b) {
  double dx = a.first - b.first;
  double dy = a.second - b.second;
  return hypot(dx, dy);
}

int main() {
  int n;
  point adil, bera, bin;
  scan(adil, bera, bin, n);
  vector<point> points(n);
  for_each(points.begin(), points.end(), [](point& p){scan(p);});

  vector<double> distances;
  distances.reserve(n);
  transform(points.begin(), points.end(), back_inserter(distances), [&bin](point const&p){
    return dist(p, bin);
  });

  double total = 2.0*accumulate(distances.begin(), distances.end(), 0.0, plus<double>());

  // <delta,index>
  vector<pair<double,int>> adil_indices(n);
  vector<pair<double,int>> bera_indices(n);

  for(int i = 0; i < n; ++i) {
    double a = dist(adil, points[i]);
    double b = dist(bera, points[i]);

    adil_indices.push_back({a - distances[i], i});
    bera_indices.push_back({b - distances[i], i});
  }

  sort(adil_indices.begin(), adil_indices.end());
  sort(bera_indices.begin(), bera_indices.end());

  double smallest = 2e9;
  smallest = min(smallest, adil_indices[0].first);
  smallest = min(smallest, bera_indices[0].first);

  if(adil_indices[0].second != bera_indices[0].second) {
    smallest = min(smallest, adil_indices[0].first + bera_indices[0].first);
  } else if(n > 1) {
    smallest = min(smallest, adil_indices[1].first + bera_indices[0].first);
    smallest = min(smallest, adil_indices[0].first + bera_indices[1].first);
  }

  putln(total + smallest);
}


/***********************************************************************/
#include <bits/stdc++.h>

#define endl ('\n')

using namespace std;

istream& operator>>(istream& in, pair<int,int>& p) {
  return in >> p.first >> p.second;
}

ostream& operator<<(ostream& out, pair<int,int> const& p) {
  return out << p.first << ' ' << p.second;
}

template<class T>
void scan(T& x) {
  cin >> x;
}

template<class T, class... Args>
void scan(T& x, Args& ...abc) {
  cin >> x;
  scan(abc...);
}

template<class T>
void put(T const& x) {
  cout << x;
}

template<class T, class... Args>
void put(T const& x, Args const& ...abc) {
  cout << x << ' ';
  put(abc...);
}

template<class T>
void putln(T const& x) {
  cout << x << endl;
}

template<class T, class... Args>
void putln(T const& x, Args const& ...abc) {
  cout << x << endl;
  putln(abc...);
}

struct _ {
 _ () {
  ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);cerr.tie(0);
  cout << fixed << setprecision(10);
  #ifndef ONLINE_JUDGE
  freopen("in", "r", stdin);
  #endif
  }
} _;

#define double long double

typedef long long ll;
typedef pair<int,int> point;

/***********************************************************************/

double dist(point const& a, point const& b) {
  double dx = a.first - b.first;
  double dy = a.second - b.second;
  return sqrt(dx*dx + dy*dy);
}

int main() {
  int n;
  point adil, bera, bin;
  scan(adil, bera, bin, n);
  vector<point> points(n);
  for_each(points.begin(), points.end(), [](point& p){scan(p);});

  vector<double> distances(n);
  transform(points.begin(), points.end(), distances.begin(), [&bin](point const&p){
    return dist(p, bin);
  });

  double total = 2*accumulate(distances.begin(), distances.end(), 0.0, plus<double>());

  // <delta,index>
  vector<pair<double,int>> adil_indices;
  vector<pair<double,int>> bera_indices;
  adil_indices.reserve(n+1);
  bera_indices.reserve(n+1);

  for(int i = 0; i < n; ++i) {
    auto a = dist(adil, points[i]);
    auto b = dist(bera, points[i]);

    adil_indices.push_back({a - distances[i], i});
    bera_indices.push_back({b - distances[i], i});
  }
  adil_indices.push_back({0, n});
  bera_indices.push_back({0, n+1});

  sort(adil_indices.begin(), adil_indices.end());
  sort(bera_indices.begin(), bera_indices.end());

  double smallest = 0.0;
  smallest = min(smallest, adil_indices[0].first);
  smallest = min(smallest, bera_indices[0].first);
  if(adil_indices[0].second != bera_indices[0].second) {
    smallest = min(adil_indices[0].first + bera_indices[0].first, smallest);
  } else {
    smallest = min(adil_indices[1].first + bera_indices[0].first, smallest);
    smallest = min(adil_indices[0].first + bera_indices[1].first, smallest);
  }

  putln(total + smallest);
}


/***********************************************************************/
#include <bits/stdc++.h>

#define endl ('\n')

using namespace std;

istream& operator>>(istream& in, pair<int,int>& p) {
  return in >> p.first >> p.second;
}

ostream& operator<<(ostream& out, pair<int,int> const& p) {
  return out << p.first << ' ' << p.second;
}

template<class T>
void scan(T& x) {
  cin >> x;
}

template<class T, class... Args>
void scan(T& x, Args& ...abc) {
  cin >> x;
  scan(abc...);
}

template<class T>
void put(T const& x) {
  cout << x;
}

template<class T, class... Args>
void put(T const& x, Args const& ...abc) {
  cout << x << ' ';
  put(abc...);
}

template<class T>
void putln(T const& x) {
  cout << x << endl;
}

template<class T, class... Args>
void putln(T const& x, Args const& ...abc) {
  cout << x << endl;
  putln(abc...);
}

struct _ {
 _ () {
  ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);cerr.tie(0);
  cout << fixed << setprecision(10);
  #ifndef ONLINE_JUDGE
  freopen("in", "r", stdin);
  #endif
  }
} _;

typedef long long ll;
typedef pair<int,int> point;

/***********************************************************************/

double dist(point const& a, point const& b) {
  double dx = a.first - b.first;
  double dy = a.second - b.second;
  return sqrt(dx*dx + dy*dy);
}

int main() {
  int n;
  point adil, bera, bin;
  scan(adil, bera, bin, n);
  vector<point> points(n);
  for_each(points.begin(), points.end(), [](point& p){scan(p);});

  vector<double> distances(n);
  transform(points.begin(), points.end(), distances.begin(), [&bin](point const&p){
    return dist(p, bin);
  });

  double total = 2*accumulate(distances.begin(), distances.end(), 0.0, plus<double>());

  // <delta,index>
  vector<pair<double,int>> adil_indices;
  vector<pair<double,int>> bera_indices;
  adil_indices.reserve(n+1);
  bera_indices.reserve(n+1);

  for(int i = 0; i < n; ++i) {
    auto a = dist(adil, points[i]);
    auto b = dist(bera, points[i]);

    adil_indices.push_back({a - distances[i], i});
    bera_indices.push_back({b - distances[i], i});
  }
  adil_indices.push_back({0, n});
  bera_indices.push_back({0, n+1});

  sort(adil_indices.begin(), adil_indices.end());
  sort(bera_indices.begin(), bera_indices.end());

  double smallest = 0.0;
  if(adil_indices[0].second != bera_indices[0].second)
    smallest = min(min(smallest, min(adil_indices[0].first, bera_indices[0].first)), adil_indices[0].first + bera_indices[0].first);
  else {
    smallest = min(min(smallest, min(adil_indices[0].first, bera_indices[1].first)), adil_indices[1].first + bera_indices[0].first);
    smallest = min(min(smallest, min(adil_indices[1].first, bera_indices[0].first)), adil_indices[0].first + bera_indices[1].first);
  }

  putln(total + smallest);
}


/***********************************************************************/
#include <bits/stdc++.h>

#define endl ('\n')

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> point;

template<class T1, class T2>
istream& operator>>(istream& in, pair<T1,T2>& p) {
  return in >> p.first >> p.second;
}

template<class T1, class T2>
ostream& operator<<(ostream& out, pair<T1,T2> const& p) {
  return out << p.first << ' ' << p.second;
}

template<class T> void scan(T& x){cin >> x;}

template<class T, class... Args>void scan(T& x, Args& ...abc){
  cin >> x; scan(abc...);
}

template<class T>void put(T const& x){cout << x;}
template<class T>void putln(T const& x){cout << x << endl;}

template<class T, class... Args>void put(T const& x, Args const& ...abc) {
  cout << x << ' '; put(abc...);
}

template<class T, class... Args>
void putln(T const& x, Args const& ...abc) {
  cout << x << endl; putln(abc...);
}

struct _ {
 _ () {
  ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);cerr.tie(0);
  cout << fixed << setprecision(12);
  #ifndef ONLINE_JUDGE
  freopen("in", "r", stdin);
  #endif
  }
} _;

/***********************************************************************/

double dist(point const& a, point const& b) {
  double dx = a.first - b.first;
  double dy = a.second - b.second;
  return hypot(dx, dy);
}

int main() {
  int n;
  point adil, bera, bin;
  scan(adil, bera, bin, n);
  vector<point> points(n);
  for_each(points.begin(), points.end(), [](point& p){scan(p);});

  vector<double> distances(n);
  transform(points.begin(), points.end(), distances.begin(), [&bin](point const&p){
    return dist(p, bin);
  });

  double total = 2.0*accumulate(distances.begin(), distances.end(), 0.0, plus<double>());

  // <delta,index>
  vector<pair<double,int>> adil_indices;
  vector<pair<double,int>> bera_indices(n);
  adil_indices.reserve(n);

  for(int i = 0; i < n; ++i) {
    double a = dist(adil, points[i]);
    double b = dist(bera, points[i]);

    adil_indices.emplace_back(make_pair(a - distances[i], i));
    bera_indices[i] = {b - distances[i], i};
  }

  sort(adil_indices.begin(), adil_indices.end());
  sort(bera_indices.begin(), bera_indices.end());

  double smallest = 2e9;
  smallest = min(smallest, adil_indices[0].first);
  smallest = min(smallest, bera_indices[0].first);

  if(adil_indices[0].second != bera_indices[0].second) {
    smallest = min(smallest, adil_indices[0].first + bera_indices[0].first);
  } else if(n > 1) {
    smallest = min(smallest, adil_indices[1].first + bera_indices[0].first);
    smallest = min(smallest, adil_indices[0].first + bera_indices[1].first);
  }

  putln(total + smallest);
}


/***********************************************************************/
#include <bits/stdc++.h>

#define endl ('\n')

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> point;

template<class T1, class T2>
istream& operator>>(istream& in, pair<T1,T2>& p) {
  return in >> p.first >> p.second;
}

template<class T1, class T2>
ostream& operator<<(ostream& out, pair<T1,T2> const& p) {
  return out << p.first << ' ' << p.second;
}

template<class T> void scan(T& x){cin >> x;}

template<class T, class... Args>void scan(T& x, Args& ...abc){
  cin >> x; scan(abc...);
}

template<class T>void put(T const& x){cout << x;}
template<class T>void putln(T const& x){cout << x << endl;}

template<class T, class... Args>void put(T const& x, Args const& ...abc) {
  cout << x << ' '; put(abc...);
}

template<class T, class... Args>
void putln(T const& x, Args const& ...abc) {
  cout << x << endl; putln(abc...);
}

struct _ {
 _ () {
  ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);cerr.tie(0);
  cout << fixed << setprecision(12);
  #ifndef ONLINE_JUDGE
  freopen("in", "r", stdin);
  #endif
  }
} _;

/***********************************************************************/

double dist(point const& a, point const& b) {
  double dx = a.first - b.first;
  double dy = a.second - b.second;
  return hypot(dx, dy);
}

int main() {
  int n;
  point adil, bera, bin;
  scan(adil, bera, bin, n);
  vector<point> points(n);
  for_each(points.begin(), points.end(), [](point& p){scan(p);});

  vector<double> distances;
  distances.reserve(n);
  transform(points.begin(), points.end(), back_inserter(distances), [&bin](point const&p){
    return dist(p, bin);
  });

  double total = 2.0*accumulate(distances.begin(), distances.end(), 0.0, plus<double>());

  // <delta,index>
  vector<pair<double,int>> adil_indices;
  vector<pair<double,int>> bera_indices;
  adil_indices.reserve(n);
  bera_indices.reserve(n);

  for(int i = 0; i < n; ++i) {
    double a = dist(adil, points[i]);
    double b = dist(bera, points[i]);

    adil_indices[i] = {a - distances[i], i};
    bera_indices.push_back({b - distances[i], i});
  }

  sort(adil_indices.begin(), adil_indices.end());
  sort(bera_indices.begin(), bera_indices.end());

  double smallest = 2e9;
  smallest = min(smallest, adil_indices[0].first);
  smallest = min(smallest, bera_indices[0].first);

  if(adil_indices[0].second != bera_indices[0].second) {
    smallest = min(smallest, adil_indices[0].first + bera_indices[0].first);
  } else if(n > 1) {
    smallest = min(smallest, adil_indices[1].first + bera_indices[0].first);
    smallest = min(smallest, adil_indices[0].first + bera_indices[1].first);
  }

  putln(total + smallest);
}


/***********************************************************************/
#include <bits/stdc++.h>

#define endl ('\n')

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> point;

#define double ld

template<class T1, class T2>
istream& operator>>(istream& in, pair<T1,T2>& p) {
  return in >> p.first >> p.second;
}

template<class T1, class T2>
ostream& operator<<(ostream& out, pair<T1,T2> const& p) {
  return out << p.first << ' ' << p.second;
}

template<class T> void scan(T& x){cin >> x;}

template<class T, class... Args>void scan(T& x, Args& ...abc){
  cin >> x; scan(abc...);
}

template<class T>void put(T const& x){cout << x;}
template<class T>void putln(T const& x){cout << x << endl;}

template<class T, class... Args>void put(T const& x, Args const& ...abc) {
  cout << x << ' '; put(abc...);
}

template<class T, class... Args>
void putln(T const& x, Args const& ...abc) {
  cout << x << endl; putln(abc...);
}

struct _ {
 _ () {
  ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);cerr.tie(0);
  cout << fixed << setprecision(12);
  #ifndef ONLINE_JUDGE
  freopen("in", "r", stdin);
  #endif
  }
} _;

/***********************************************************************/

double dist(point const& a, point const& b) {
  double dx = a.first - b.first;
  double dy = a.second - b.second;
  return hypot(dx, dy);
}

int main() {
  int n;
  point adil, bera, bin;
  scan(adil, bera, bin, n);
  vector<point> points(n);
  for_each(points.begin(), points.end(), [](point& p){scan(p);});

  vector<double> distances(n);
  transform(points.begin(), points.end(), distances.begin(), [&bin](point const&p){
    return dist(p, bin);
  });

  double total = 2.0*accumulate(distances.begin(), distances.end(), 0.0, plus<double>());

  // <delta,index>
  vector<pair<double,int>> adil_indices;
  vector<pair<double,int>> bera_indices;
  adil_indices.reserve(n+1);
  bera_indices.reserve(n+1);
  adil_indices.push_back({0.0, n});
  bera_indices.push_back({0.0, n+1});

  for(int i = 0; i < n; ++i) {
    double a = dist(adil, points[i]);
    double b = dist(bera, points[i]);

    adil_indices.push_back({a - distances[i], i});
    bera_indices.push_back({b - distances[i], i});
  }

  sort(adil_indices.begin(), adil_indices.end());
  sort(bera_indices.begin(), bera_indices.end());

  double smallest = 0.0;
  smallest = min(smallest, adil_indices[0].first);
  smallest = min(smallest, bera_indices[0].first);

  if(adil_indices[0].second != bera_indices[0].second) {
    smallest = min(smallest, adil_indices[0].first + bera_indices[0].first);
  } else {
    smallest = min(smallest, adil_indices[1].first + bera_indices[0].first);
    smallest = min(smallest, adil_indices[0].first + bera_indices[1].first);
  }

  putln(total + smallest);
}


/***********************************************************************/
#include <bits/stdc++.h>

#define endl ('\n')

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> point;

template<class T1, class T2>
istream& operator>>(istream& in, pair<T1,T2>& p) {
  return in >> p.first >> p.second;
}

template<class T1, class T2>
ostream& operator<<(ostream& out, pair<T1,T2> const& p) {
  return out << p.first << ' ' << p.second;
}

template<class T> void scan(T& x){cin >> x;}

template<class T, class... Args>void scan(T& x, Args& ...abc){
  cin >> x; scan(abc...);
}

template<class T>void put(T const& x){cout << x;}
template<class T>void putln(T const& x){cout << x << endl;}

template<class T, class... Args>void put(T const& x, Args const& ...abc) {
  cout << x << ' '; put(abc...);
}

template<class T, class... Args>
void putln(T const& x, Args const& ...abc) {
  cout << x << endl; putln(abc...);
}

struct _ {
 _ () {
  ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0);cerr.tie(0);
  cout << fixed << setprecision(12);
  #ifndef ONLINE_JUDGE
  freopen("in", "r", stdin);
  #endif
  }
} _;

/***********************************************************************/

double dist(point const& a, point const& b) {
  double dx = a.first - b.first;
  double dy = a.second - b.second;
  return hypot(dx, dy);
}

int main() {
  int n;
  point adil, bera, bin;
  scan(adil, bera, bin, n);
  vector<point> points(n);
  for_each(points.begin(), points.end(), [](point& p){scan(p);});

  vector<double> distances;
  distances.reserve(n);
  transform(points.begin(), points.end(), back_inserter(distances), [&bin](point const&p){
    return dist(p, bin);
  });

  double total = 2.0*accumulate(distances.begin(), distances.end(), 0.0, plus<double>());

  // <delta,index>
  vector<pair<double,int>> adil_indices;
  vector<pair<double,int>> bera_indices;
  adil_indices.reserve(n);
  bera_indices.reserve(n);

  for(int i = 0; i < n; ++i) {
    double a = dist(adil, points[i]);
    double b = dist(bera, points[i]);

    adil_indices.push_back({a - distances[i], i});
    bera_indices.push_back({b - distances[i], i});
  }

  sort(adil_indices.begin(), adil_indices.end());
  sort(bera_indices.begin(), bera_indices.end());

  double smallest = 2e9;
  smallest = min(smallest, adil_indices[0].first);
  smallest = min(smallest, bera_indices[0].first);

  if(adil_indices[0].second != bera_indices[0].second) {
    smallest = min(smallest, adil_indices[0].first + bera_indices[0].first);
  } else if(n > 1) {
    smallest = min(smallest, adil_indices[1].first + bera_indices[0].first);
    smallest = min(smallest, adil_indices[0].first + bera_indices[1].first);
  }

  putln(total + smallest);
}


/*
�Ȱ�������������������Ͱ������Ȼ��ö���Ƿ��ܹ��Ż�
*/
#include <cstdio>
#include <cmath>
#define min(x,y) x<y?x:y
const int maxN=100005;
struct node{
    double x,y;
}r[maxN];
int n;
double a[maxN];//distance from a to r[i]
double b[maxN];//distance from b to r[i]
double t[maxN];//distance from t to r[i]
double dis(double ax,double ay,double bx,double by)
{
    return sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
}
int main()
{
    double ax,ay,bx,by,tx,ty;
    while(scanf("%lf%lf%lf%lf%lf%lf",&ax,&ay,&bx,&by,&tx,&ty)!=EOF)
    {
        scanf("%d",&n);
        double ans=0;
        for(int i=1;i<=n;i++){
            scanf("%lf%lf",&r[i].x,&r[i].y);
            t[i]=dis(r[i].x,r[i].y,tx,ty);
            ans+=2*t[i];
            a[i]=dis(r[i].x,r[i].y,ax,ay);
            b[i]=dis(r[i].x,r[i].y,bx,by);
        }
        double minm,minn;
        minm=minn=9999999999;
        int node1=1,node2=1;
        for(int i=1;i<=n;i++)
        {
            if(a[i]-t[i]<minm)
            {
                minm=a[i]-t[i];
                node1=i;
            }
            if(b[i]-t[i]<minn)
            {
                minn=b[i]-t[i];
                node2=i;
            }
        }
        double s=ans;
        t[0]=a[0]=b[0]=0;
        if(minm<0&&minn<0)
        {
            if(node1!=node2)ans+=minm+minn;
            else{
                for(int i=0;i<=n;i++)
                {
                    if(i!=node1){
                        s=min(ans-t[node1]+a[node1]-t[i]+b[i],s);
                    }
                }
                for(int i=0;i<=n;i++)
                {
                    if(i!=node1){
                        s=min(ans-t[node1]+b[node1]-t[i]+a[i],s);
                    }
                }
                ans=s;
            }
        }
        else{
            ans+=min(minn,minm);
        }
        printf("%.12f\n",ans);
    }
    return 0;
}


/*
�Ȱ�������������������Ͱ������Ȼ��ö���Ƿ��ܹ��Ż�
*/
#include <cstdio>
#include <cmath>
#define min(x,y) x<y?x:y
const int maxN=100005;
struct node{
    double x,y;
}r[maxN];
int n;
double a[maxN];//distance from a to r[i]
double b[maxN];//distance from b to r[i]
double t[maxN];//distance from t to r[i]
double dis(double ax,double ay,double bx,double by)
{
    return sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
}
int main()
{
    double ax,ay,bx,by,tx,ty;
    while(scanf("%lf%lf%lf%lf%lf%lf",&ax,&ay,&bx,&by,&tx,&ty)!=EOF)
    {
        scanf("%d",&n);
        double ans=0;
        for(int i=1;i<=n;i++){
            scanf("%lf%lf",&r[i].x,&r[i].y);
            t[i]=dis(r[i].x,r[i].y,tx,ty);
            ans+=2*t[i];
            a[i]=dis(r[i].x,r[i].y,ax,ay);
            b[i]=dis(r[i].x,r[i].y,bx,by);
        }
        double minm,minn;
        minm=minn=9999999999;
        int node1=1,node2=1;
        for(int i=1;i<=n;i++)
        {
            if(a[i]-t[i]<minm)
            {
                minm=a[i]-t[i];
                node1=i;
            }
            if(b[i]-t[i]<minn)
            {
                minn=b[i]-t[i];
                node2=i;
            }
        }
        double s=ans;
        if(minm<0&&minn<0)
        {
            if(node1!=node2)ans+=minm+minn;
            else{
                for(int i=1;i<=n;i++)
                {
                    if(i!=node1){
                        s=min(ans-t[node1]+a[node1]-t[i],s);
                        s=min(ans+b[node1]-t[i]-t[node1],s);
                    }
                }
                ans=s;
            }
        }
        else{
            ans+=min(minn,minm);
        }
        printf("%.12f\n",ans);
    }
    return 0;
}


/*
�Ȱ�������������������Ͱ������Ȼ��ö���Ƿ��ܹ��Ż�
*/
#include <cstdio>
#include <cmath>
#define min(x,y) x<y?x:y
const int maxN=100005;
struct node{
    double x,y;
}r[maxN];
int n;
double a[maxN];//distance from a to r[i]
double b[maxN];//distance from b to r[i]
double t[maxN];//distance from t to r[i]
double dis(double ax,double ay,double bx,double by)
{
    return sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
}
int main()
{
    double ax,ay,bx,by,tx,ty;
    while(scanf("%lf%lf%lf%lf%lf%lf",&ax,&ay,&bx,&by,&tx,&ty)!=EOF)
    {
        scanf("%d",&n);
        double ans=0;
        for(int i=1;i<=n;i++){
            scanf("%lf%lf",&r[i].x,&r[i].y);
            t[i]=dis(r[i].x,r[i].y,tx,ty);
            ans+=2*t[i];
            a[i]=dis(r[i].x,r[i].y,ax,ay);
            b[i]=dis(r[i].x,r[i].y,bx,by);
        }
        double minm,minn;
        minm=minn=9999999999;
        int node1=1,node2=1;
        for(int i=1;i<=n;i++)
        {
            if(a[i]-t[i]<minm)
            {
                minm=a[i]-t[i];
                node1=i;
            }
            if(b[i]-t[i]<minn)
            {
                minn=b[i]-t[i];
                node2=i;
            }
        }
        double s=ans;
        if(minm<0&&minn<0)
        {
            if(node1!=node2)ans+=minm+minn;
            else{
                for(int i=1;i<=n;i++)
                {
                    if(i!=node1){
                        s=min(ans-t[i]+a[i]-t[node1],s);
                        s=min(ans+b[i]-t[i]-t[node1],s);
                    }
                }
                ans=s;
            }
        }
        else{
            ans+=min(minn,minm);
        }
        printf("%.12f\n",ans);
    }
    return 0;
}


/*
�Ȱ�������������������Ͱ������Ȼ��ö���Ƿ��ܹ��Ż�
*/
#include <cstdio>
#include <cmath>
#define min(x,y) x<y?x:y
const int maxN=100005;
struct node{
    double x,y;
}r[maxN];
int n;
double a[maxN];//distance from a to r[i]
double b[maxN];//distance from b to r[i]
double t[maxN];//distance from t to r[i]
double dis(double ax,double ay,double bx,double by)
{
    return sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
}
int main()
{
    double ax,ay,bx,by,tx,ty;
    while(scanf("%lf%lf%lf%lf%lf%lf",&ax,&ay,&bx,&by,&tx,&ty)!=EOF)
    {
        scanf("%d",&n);
        double ans=0;
        for(int i=1;i<=n;i++){
            scanf("%lf%lf",&r[i].x,&r[i].y);
            t[i]=dis(r[i].x,r[i].y,tx,ty);
            ans+=2*t[i];
            a[i]=dis(r[i].x,r[i].y,ax,ay);
            b[i]=dis(r[i].x,r[i].y,bx,by);
        }
        double minm,minn;
        minm=minn=9999999999;
        int node1=1,node2=1;
        for(int i=1;i<=n;i++)
        {
            if(a[i]-t[i]<minm)
            {
                minm=a[i]-t[i];
                node1=i;
            }
            if(b[i]-t[i]<minn)
            {
                minn=b[i]-t[i];
                node2=i;
            }
        }
        if(minm<0&&minn<0)
        {
            if(node1!=node2)ans+=minm+minn;
            else{
                ans+=min(minm,minn);
                minm=9999999999;
                for(int i=1;i<=n;i++)
                {
                    if(i!=node1){
                        minm=min(a[i]-t[i],minm);
                        minm=min(b[i]-t[i],minm);
                    }
                }
                ans+=min(0,minm);
            }
        }
        else{
            ans+=min(minn,minm);
        }
        printf("%.12f\n",ans);
    }
    return 0;
}


/*
�Ȱ�������������������Ͱ������Ȼ��ö���Ƿ��ܹ��Ż�
*/
#include <cstdio>
#include <cmath>
#define min(x,y) x<y?x:y
const int maxN=100005;
struct node{
    double x,y;
}r[maxN];
int n;
double a[maxN];//distance from a to r[i]
double b[maxN];//distance from b to r[i]
double t[maxN];//distance from t to r[i]
double dis(double ax,double ay,double bx,double by)
{
    return sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
}
int main()
{
    double ax,ay,bx,by,tx,ty;
    while(scanf("%lf%lf%lf%lf%lf%lf",&ax,&ay,&bx,&by,&tx,&ty)!=EOF)
    {
        scanf("%d",&n);
        double ans=0;
        for(int i=1;i<=n;i++){
            scanf("%lf%lf",&r[i].x,&r[i].y);
            t[i]=dis(r[i].x,r[i].y,tx,ty);
            ans+=2*t[i];
            a[i]=dis(r[i].x,r[i].y,ax,ay);
            b[i]=dis(r[i].x,r[i].y,bx,by);
        }
        double minm,minn;
        minm=minn=9999999999;
        int node1=1,node2=1;
        for(int i=1;i<=n;i++)
        {
            if(a[i]-t[i]<minm)
            {
                minm=a[i]-t[i];
                node1=i;
            }
            if(b[i]-t[i]<minn)
            {
                minn=b[i]-t[i];
                node2=i;
            }
        }
        double s=ans;
        if(minm<0&&minn<0)
        {
            if(node1!=node2)ans+=minm+minn;
            else{
                for(int i=1;i<=n;i++)
                {
                    if(i!=node1){
                        s=min(ans-t[node1]+a[node1]-t[i]+a[i],s);
                    }
                }
                for(int i=1;i<=n;i++)
                {
                    if(i!=node1){
                        s=min(ans-t[node1]+b[node1]-t[i]+b[i],s);
                    }
                }
                ans=s;
            }
        }
        else{
            ans+=min(minn,minm);
        }
        printf("%.12f\n",ans);
    }
    return 0;
}


/*
�Ȱ�������������������Ͱ������Ȼ��ö���Ƿ��ܹ��Ż�
*/
#include <cstdio>
#include <cmath>
#define min(x,y) x<y?x:y
const int maxN=100005;
struct node{
    double x,y;
}r[maxN];
int n;
double a[maxN];//distance from a to r[i]
double b[maxN];//distance from b to r[i]
double t[maxN];//distance from t to r[i]
double dis(double ax,double ay,double bx,double by)
{
    return sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
}
int main()
{
    double ax,ay,bx,by,tx,ty;
    while(scanf("%lf%lf%lf%lf%lf%lf",&ax,&ay,&bx,&by,&tx,&ty)!=EOF)
    {
        scanf("%d",&n);
        double ans=0;
        for(int i=1;i<=n;i++){
            scanf("%lf%lf",&r[i].x,&r[i].y);
            t[i]=dis(r[i].x,r[i].y,tx,ty);
            ans+=2*t[i];
            a[i]=dis(r[i].x,r[i].y,ax,ay);
            b[i]=dis(r[i].x,r[i].y,bx,by);
        }
        double minm,minn;
        minm=minn=9999999999;
        int node1=1,node2=1;
        for(int i=1;i<=n;i++)
        {
            if(a[i]-t[i]<minm)
            {
                minm=a[i]-t[i];
                node1=i;
            }
            if(b[i]-t[i]<minn)
            {
                minn=b[i]-t[i];
                node2=i;
            }
        }
        if(minm<0&&minn<0)
        {
            if(node1!=node2)ans+=minm+minn;
            else{
                ans+=min(minm,minn);
                minm=9999999999;
                for(int i=1;i<=n;i++)
                {
                    if(i!=node1){
                        ans=min(ans-t[i]+a[i]-t[node1],ans);
                        ans=min(ans+b[i]-t[i]-t[node1],ans);
                    }
                }
            }
        }
        else{
            ans+=min(minn,minm);
        }
        printf("%.12f\n",ans);
    }
    return 0;
}


/*
�Ȱ�������������������Ͱ������Ȼ��ö���Ƿ��ܹ��Ż�
*/
#include <cstdio>
#include <cmath>
#define min(x,y) x<y?x:y
const int maxN=100005;
struct node{
    double x,y;
}r[maxN];
int n;
double a[maxN];//distance from a to r[i]
double b[maxN];//distance from b to r[i]
double t[maxN];//distance from t to r[i]
double dis(double ax,double ay,double bx,double by)
{
    return sqrt((ax-bx)*(ax-bx)+(ay-by)*(ay-by));
}
int main()
{
    double ax,ay,bx,by,tx,ty;
    while(scanf("%lf%lf%lf%lf%lf%lf",&ax,&ay,&bx,&by,&tx,&ty)!=EOF)
    {
        scanf("%d",&n);
        double ans=0;
        for(int i=1;i<=n;i++){
            scanf("%lf%lf",&r[i].x,&r[i].y);
            t[i]=dis(r[i].x,r[i].y,tx,ty);
            ans+=2*t[i];
            a[i]=dis(r[i].x,r[i].y,ax,ay);
            b[i]=dis(r[i].x,r[i].y,bx,by);
        }
        double minm,minn;
        minm=minn=9999999999;
        int node1=1,node2=1;
        for(int i=1;i<=n;i++)
        {
            if(a[i]-t[i]<minm)
            {
                minm=a[i]-t[i];
                node1=i;
            }
            if(b[i]-t[i]<minn)
            {
                minn=b[i]-t[i];
                node2=i;
            }
        }
        if(minm<0&&minn<0)
        {
            if(node1!=node2)ans+=minm+minn;
            else{
                for(int i=1;i<=n;i++)
                {
                    if(i!=node1){
                        ans=min(ans-t[i]+a[i]-t[node1],ans);
                        ans=min(ans+b[i]-t[i]-t[node1],ans);
                    }
                }
            }
        }
        else{
            ans+=min(minn,minm);
        }
        printf("%.12f\n",ans);
    }
    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <string>
#include <algorithm>
#include <chrono>
#include <limits>
#include <cmath>
#include <unordered_set>
#include <set>

using namespace std;
using ll = long long;

double dist(pair<ll, ll> p1, ll x, ll y) {
    return sqrt(pow(p1.first - x, 2) + pow(p1.second - y, 2));
}

ll tx, ty;

// forbid, sv
pair<ll, double> get_sv(const vector<pair<ll, ll>>& bins, const ll forbid_idx, const ll x, const ll y) {
    ll idx = -1;
    double sv = -1 * numeric_limits<double>::max();
    for (ll i = 0; i < bins.size(); ++i) {
        if (i == forbid_idx) continue;

        double cur_sv = dist(bins[i], tx, ty) - dist(bins[i], x, y);
        if (cur_sv > sv) {
            idx = i;
            sv = cur_sv;
        }
    }
    return {idx, sv};
}

int main()
{
    ll ax, ay, bx, by;
    cin >> ax >> ay >> bx >> by >> tx >> ty;

    ll n;
    cin >> n;

    vector<pair<ll, ll>> bins(n); // x y
    for (ll i = 0; i < n; ++i) {
        cin >> bins[i].first >> bins[i].second;
    }

    double sv_a = 0;
    double sv_b = 0;

    double var1 = 0.0;
    {
        auto p1 = get_sv(bins, -1, ax, ay);// forbid, sv
        auto p2 = get_sv(bins, p1.first, bx, by);
        var1 = p1.second + p2.second;
    }

    double var2 = 0.0;
    {
        auto p1 = get_sv(bins, -1, bx, by);// forbid, sv
        auto p2 = get_sv(bins, p1.first, ax, ay);
        var2 = p1.second + p2.second;
    }

    double ans = 0.0;
    for (auto& b : bins) {
        ans += 2*dist(b, tx, ty);
    }

    ans -= max(var1, var2);

    cout.precision(17);
    cout << ans << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <string>
#include <algorithm>
#include <chrono>
#include <limits>
#include <cmath>
#include <unordered_set>
#include <set>

using namespace std;
using ll = long long;

double dist(pair<ll, ll> p1, ll x, ll y) {
    return pow(p1.first - x, 2) + pow(p1.second - y, 2);
}

ll tx, ty;

// forbid, sv
pair<ll, double> get_sv(const vector<pair<ll, ll>>& bins, const ll forbid_idx, const ll x, const ll y) {
    ll idx = -1;
    double sv = -1 * numeric_limits<double>::max();
    for (ll i = 0; i < bins.size(); ++i) {
        if (i == forbid_idx) continue;

        double cur_sv = dist(bins[i], tx, ty) - dist(bins[i], x, y);
        if (cur_sv > sv) {
            idx = i;
            sv = cur_sv;
        }
    }
    return {idx, sv};
}

int main()
{
    ll ax, ay, bx, by;
    cin >> ax >> ay >> bx >> by >> tx >> ty;

    ll n;
    cin >> n;

    vector<pair<ll, ll>> bins(n); // x y
    for (ll i = 0; i < n; ++i) {
        cin >> bins[i].first >> bins[i].second;
    }

    double sv_a = 0;
    double sv_b = 0;

    double var1 = 0.0;
    {
        auto p1 = get_sv(bins, -1, ax, ay);// forbid, sv
        auto p2 = get_sv(bins, p1.first, bx, by);
        var1 = p1.second + p2.second;
    }

    double var2 = 0.0;
    {
        auto p1 = get_sv(bins, -1, bx, by);// forbid, sv
        auto p2 = get_sv(bins, p1.first, ax, ay);
        var2 = p1.second + p2.second;
    }

    double ans = 0.0;
    for (auto& b : bins) {
        ans += 2*dist(b, tx, ty);
    }

    ans -= max(var1, var2);

    cout.precision(17);
    cout << ans << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <string>
#include <algorithm>
#include <chrono>
#include <limits>
#include <cmath>
#include <unordered_set>
#include <set>

using namespace std;
using ll = long long;

ll dist(pair<ll, ll> p1, ll x, ll y) {
    return (p1.first - x)*(p1.first - x) + (p1.second - y)*(p1.second - y);
}

ll tx, ty;

// forbid, sv
pair<ll, double> get_sv(const vector<pair<ll, ll>>& bins, const ll forbid_idx, const ll x, const ll y) {
    ll idx = 0;
    double sv = sqrt(dist(bins[0], tx, ty)) - sqrt(dist(bins[0], x, y));
    for (ll i = 1; i < bins.size(); ++i) {
        if (i == forbid_idx) continue;

        double cur_sv = sqrt(dist(bins[i], tx, ty)) - sqrt(dist(bins[i], x, y));
        if (cur_sv > sv) {
            idx = i;
            sv = cur_sv;
        }
    }
    return {idx, sv};
}

int main()
{
    ll ax, ay, bx, by;
    cin >> ax >> ay >> bx >> by >> tx >> ty;

    ll n;
    cin >> n;

    vector<pair<ll, ll>> bins(n); // x y
    for (ll i = 0; i < n; ++i) {
        cin >> bins[i].first >> bins[i].second;
    }

    double sv_a = 0;
    double sv_b = 0;

    double var1 = 0.0;
    {
        auto p1 = get_sv(bins, -1, ax, ay);// forbid, sv
        auto p2 = get_sv(bins, p1.first, bx, by);
        var1 = p1.second + p2.second;
    }

    double var2 = 0.0;
    {
        auto p1 = get_sv(bins, -1, bx, by);// forbid, sv
        auto p2 = get_sv(bins, p1.first, ax, ay);
        var2 = p1.second + p2.second;
    }

    double ans = 0.0;
    for (auto& b : bins) {
        ans += 2*sqrt(dist(b, tx, ty));
    }

    ans -= max(var1, var2);

    cout.precision(17);
    cout << ans << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <string>
#include <algorithm>
#include <chrono>
#include <limits>
#include <cmath>
#include <unordered_set>
#include <set>

using namespace std;
using ll = long long;

ll dist(pair<ll, ll> p1, ll x, ll y) {
    return (p1.first - x)*(p1.first - x) + (p1.second - y)*(p1.second - y);
}

ll tx, ty;

// forbid, sv
pair<ll, double> get_sv(const vector<pair<ll, ll>>& bins, const ll forbid_idx, const ll x, const ll y) {
    ll idx = -1;
    double sv = -DBL_MAX;
    for (ll i = 0; i < bins.size(); ++i) {
        if (i == forbid_idx) continue;

        double cur_sv = sqrt(dist(bins[i], tx, ty)) - sqrt(dist(bins[i], x, y));
        if (cur_sv > sv) {
            idx = i;
            sv = cur_sv;
        }
    }
    return {idx, sv};
}

int main()
{
    ll ax, ay, bx, by;
    cin >> ax >> ay >> bx >> by >> tx >> ty;

    ll n;
    cin >> n;

    vector<pair<ll, ll>> bins(n); // x y
    for (ll i = 0; i < n; ++i) {
        cin >> bins[i].first >> bins[i].second;
    }

    double sv_a = 0;
    double sv_b = 0;

    double var1 = 0.0;
    {
        auto p1 = get_sv(bins, -1, ax, ay);// forbid, sv
        auto p2 = get_sv(bins, p1.first, bx, by);
        var1 = p1.second + p2.second;
    }

    double var2 = 0.0;
    {
        auto p1 = get_sv(bins, -1, bx, by);// forbid, sv
        auto p2 = get_sv(bins, p1.first, ax, ay);
        var2 = p1.second + p2.second;
    }

    double ans = 0.0;
    for (auto& b : bins) {
        ans += 2*sqrt(dist(b, tx, ty));
    }

    ans -= max(var1, var2);

    cout.precision(17);
    cout << ans << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <string>
#include <algorithm>
#include <chrono>
#include <limits>
#include <cmath>
#include <unordered_set>
#include <set>

using namespace std;
using ll = long long;

double dist(pair<ll, ll> p1, ll x, ll y) {
    return sqrt(pow(p1.first - x, 2) + pow(p1.second - y, 2));
}

ll tx, ty;

int main()
{
    ll ax, ay, bx, by;
    cin >> ax >> ay >> bx >> by >> tx >> ty;

    ll n;
    cin >> n;

    vector<pair<ll, ll>> bins(n); // x y

    double sum = 0.0;
    const double MAXX = numeric_limits<double>::max();
    double dbin, da, db, pa, pb, pA = MAXX, pB = MAXX, pab = MAXX;
    for (ll i = 0; i < n; ++i) {
        cin >> bins[i].first >> bins[i].second;

        dbin = dist(bins[i], tx, ty);
        da = dist(bins[i], ax, ay);
        db = dist(bins[i], bx, by);

        pa = da - dbin;
        pb = db - dbin;

        pab = min(pab, min(pA + pb, pB + pa));

        pA = min(pa, pA);
        pB = min(pb, pB);

        sum += 2*dbin;
    }

    double ans = sum + pab;// min(pab, min(pA, pB));
    cout.precision(17);
    cout << ans << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <string>
#include <algorithm>
#include <chrono>
#include <limits>
#include <cmath>
#include <unordered_set>
#include <set>

using namespace std;
using ll = long long;

ll dist(pair<ll, ll> p1, ll x, ll y) {
    return (p1.first - x)*(p1.first - x) + (p1.second - y)*(p1.second - y);
}

ll tx, ty;

// forbid, sv
pair<ll, double> get_sv(const vector<pair<ll, ll>>& bins, const ll forbid_idx, const ll x, const ll y) {
    ll idx = -1;
    double sv = -1e10;
    for (ll i = 0; i < bins.size(); ++i) {
        if (i == forbid_idx) continue;

        double cur_sv = sqrt(dist(bins[i], tx, ty)) - sqrt(dist(bins[i], x, y));
        if (cur_sv > sv) {
            idx = i;
            sv = cur_sv;
        }
    }
    return {idx, sv};
}

int main()
{
    ll ax, ay, bx, by;
    cin >> ax >> ay >> bx >> by >> tx >> ty;

    ll n;
    cin >> n;

    vector<pair<ll, ll>> bins(n); // x y
    for (ll i = 0; i < n; ++i) {
        cin >> bins[i].first >> bins[i].second;
    }

    double sv_a = 0;
    double sv_b = 0;

    double var1 = 0.0;
    {
        auto p1 = get_sv(bins, -1, ax, ay);// forbid, sv
        auto p2 = get_sv(bins, p1.first, bx, by);
        var1 = p1.second + p2.second;
    }

    double var2 = 0.0;
    {
        auto p1 = get_sv(bins, -1, bx, by);// forbid, sv
        auto p2 = get_sv(bins, p1.first, ax, ay);
        var2 = p1.second + p2.second;
    }

    double ans = 0.0;
    for (auto& b : bins) {
        ans += 2*sqrt(dist(b, tx, ty));
    }

    ans -= max(var1, var2);

    cout.precision(17);
    cout << ans << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <string>
#include <algorithm>
#include <chrono>
#include <limits>
#include <cmath>
#include <unordered_set>
#include <set>

using namespace std;
using ll = long long;

double dist(pair<ll, ll> p1, ll x, ll y) {
    return sqrt(pow(p1.first - x, 2) + pow(p1.second - y, 2));
}

ll tx, ty;

int main()
{
    ll ax, ay, bx, by;
    cin >> ax >> ay >> bx >> by >> tx >> ty;

    ll n;
    cin >> n;

    vector<pair<ll, ll>> bins(n); // x y

    double sum = 0.0;
    const double MAXX = numeric_limits<double>::max();
    double dbin, da, db, pa, pb, pA = MAXX, pB = MAXX, pab = MAXX;
    for (ll i = 0; i < n; ++i) {
        cin >> bins[i].first >> bins[i].second;

        dbin = dist(bins[i], tx, ty);
        da = dist(bins[i], ax, ay);
        db = dist(bins[i], bx, by);

        pa = da - dbin;
        pb = db - dbin;

        pab = min(pab, min(pA + pb, pB + pa));

        pA = min(pa, pA);
        pB = min(pb, pB);

        sum += 2*dbin;
    }

    double ans = sum + min(pab, min(pA, pB));
    cout.precision(17);
    cout << ans << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <string>
#include <algorithm>
#include <chrono>
#include <limits>
#include <cmath>
#include <unordered_set>
#include <set>

using namespace std;
using ll = long long;

ll dist(pair<ll, ll> p1, ll x, ll y) {
    return (p1.first - x)*(p1.first - x) + (p1.second - y)*(p1.second - y);
}

ll tx, ty;

// forbid, sv
pair<ll, double> get_sv(const vector<pair<ll, ll>>& bins, const ll forbid_idx, const ll x, const ll y) {
    ll idx = -1;
    double sv = -1 * numeric_limits<double>::max();
    for (ll i = 0; i < bins.size(); ++i) {
        if (i == forbid_idx) continue;

        double cur_sv = sqrt(dist(bins[i], tx, ty)) - sqrt(dist(bins[i], x, y));
        if (cur_sv > sv) {
            idx = i;
            sv = cur_sv;
        }
    }
    return {idx, sv};
}

int main()
{
    ll ax, ay, bx, by;
    cin >> ax >> ay >> bx >> by >> tx >> ty;

    ll n;
    cin >> n;

    vector<pair<ll, ll>> bins(n); // x y
    for (ll i = 0; i < n; ++i) {
        cin >> bins[i].first >> bins[i].second;
    }

    double sv_a = 0;
    double sv_b = 0;

    double var1 = 0.0;
    {
        auto p1 = get_sv(bins, -1, ax, ay);// forbid, sv
        auto p2 = get_sv(bins, p1.first, bx, by);
        var1 = p1.second + p2.second;
    }

    double var2 = 0.0;
    {
        auto p1 = get_sv(bins, -1, bx, by);// forbid, sv
        auto p2 = get_sv(bins, p1.first, ax, ay);
        var2 = p1.second + p2.second;
    }

    double ans = 0.0;
    for (auto& b : bins) {
        ans += 2*sqrt(dist(b, tx, ty));
    }

    ans -= max(var1, var2);

    cout.precision(17);
    cout << ans << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <string>
#include <algorithm>
#include <chrono>
#include <limits>
#include <cmath>
#include <unordered_set>
#include <set>

using namespace std;
using ll = long long;

double dist(pair<ll, ll> p1, ll x, ll y) {
    return sqrt((p1.first - x)*(p1.first - x) + (p1.second - y)*(p1.second - y));
}

ll tx, ty;

int main()
{
    ll ax, ay, bx, by;
    cin >> ax >> ay >> bx >> by >> tx >> ty;

    ll n;
    cin >> n;

    vector<pair<ll, ll>> bins(n); // x y

    double sum = 0.0;
    double dbin, da, db, pa, pb, pA = 0.0, pB = 0.0, pab = 0.0;
    for (ll i = 0; i < n; ++i) {
        cin >> bins[i].first >> bins[i].second;

        dbin = dist(bins[i], tx, ty);
        da = dist(bins[i], ax, ay);
        db = dist(bins[i], bx, by);

        pa = da - dbin;
        pb = db - dbin;

        pab = min(pab, min(pA + pb, pB + pa));

        pA = min(pa, pA);
        pB = min(pb, pB);

        sum += 2*dbin;
    }

    double ans = sum + min(pab, min(pA, pB));
    cout.precision(17);
    cout << ans << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <string>
#include <algorithm>
#include <chrono>
#include <limits>
#include <cmath>
#include <unordered_set>
#include <set>

using namespace std;
using ll = long long;

ll dist(pair<ll, ll> p1, ll x, ll y) {
    return (p1.first - x)*(p1.first - x) + (p1.second - y)*(p1.second - y);
}

ll tx, ty;

// forbid, sv
pair<ll, double> get_sv(const vector<pair<ll, ll>>& bins, const ll forbid_idx, const ll x, const ll y) {
    ll idx = -1;
    double sv = 0.0;
    for (ll i = 0; i < bins.size(); ++i) {
        if (i == forbid_idx) continue;

        double cur_sv = sqrt(dist(bins[i], tx, ty)) - sqrt(dist(bins[i], x, y));
        if (cur_sv > sv) {
            idx = i;
            sv = cur_sv;
        }
    }
    return {idx, sv};
}

int main()
{
    ll ax, ay, bx, by;
    cin >> ax >> ay >> bx >> by >> tx >> ty;

    ll n;
    cin >> n;

    vector<pair<ll, ll>> bins(n); // x y
    for (ll i = 0; i < n; ++i) {
        cin >> bins[i].first >> bins[i].second;
    }

    double sv_a = 0;
    double sv_b = 0;

    double var1 = 0.0;
    {
        auto p1 = get_sv(bins, -1, ax, ay);// forbid, sv
        auto p2 = get_sv(bins, p1.first, bx, by);
        var1 = p1.second + p2.second;
    }

    double var2 = 0.0;
    {
        auto p1 = get_sv(bins, -1, bx, by);// forbid, sv
        auto p2 = get_sv(bins, p1.first, ax, ay);
        var2 = p1.second + p2.second;
    }

    double ans = 0.0;
    for (auto& b : bins) {
        ans += 2*sqrt(dist(b, tx, ty));
    }

    ans -= max(var1, var2);

    cout.precision(17);
    cout << ans << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <string>
#include <algorithm>
#include <chrono>
#include <limits>
#include <cmath>
#include <unordered_set>
#include <set>

using namespace std;
using ll = long long;

ll dist(pair<ll, ll> p1, ll x, ll y) {
    return (p1.first - x)*(p1.first - x) + (p1.second - y)*(p1.second - y);
}

ll tx, ty;

// forbid, sv
pair<ll, double> get_sv(const vector<pair<ll, ll>>& bins, const ll forbid_idx, const ll x, const ll y) {
    ll idx = -1;
    double sv = numeric_limits<double>::min();
    for (ll i = 0; i < bins.size(); ++i) {
        if (i == forbid_idx) continue;

        double cur_sv = sqrt(dist(bins[i], tx, ty)) - sqrt(dist(bins[i], x, y));
        if (cur_sv > sv) {
            idx = i;
            sv = cur_sv;
        }
    }
    return {idx, sv};
}

int main()
{
    ll ax, ay, bx, by;
    cin >> ax >> ay >> bx >> by >> tx >> ty;

    ll n;
    cin >> n;

    vector<pair<ll, ll>> bins(n); // x y
    for (ll i = 0; i < n; ++i) {
        cin >> bins[i].first >> bins[i].second;
    }

    double sv_a = 0;
    double sv_b = 0;

    double var1 = 0.0;
    {
        auto p1 = get_sv(bins, -1, ax, ay);// forbid, sv
        auto p2 = get_sv(bins, p1.first, bx, by);
        var1 = p1.second + p2.second;
    }

    double var2 = 0.0;
    {
        auto p1 = get_sv(bins, -1, bx, by);// forbid, sv
        auto p2 = get_sv(bins, p1.first, ax, ay);
        var2 = p1.second + p2.second;
    }

    double ans = 0.0;
    for (auto& b : bins) {
        ans += 2*sqrt(dist(b, tx, ty));
    }

    ans -= max(var1, var2);

    cout.precision(17);
    cout << ans << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <list>
#include <string>
#include <algorithm>
#include <chrono>
#include <limits>
#include <cmath>
#include <unordered_set>
#include <set>

using namespace std;
using ll = long long;

ll dist(pair<ll, ll> p1, ll x, ll y) {
    return (p1.first - x)*(p1.first - x) + (p1.second - y)*(p1.second - y);
}

ll tx, ty;

// forbid, sv
pair<ll, double> get_sv(const vector<pair<ll, ll>>& bins, const ll forbid_idx, const ll x, const ll y) {
    ll idx = -1;
    double sv = -numeric_limits<double>::max();
    for (ll i = 0; i < bins.size(); ++i) {
        if (i == forbid_idx) continue;

        double cur_sv = sqrt(dist(bins[i], tx, ty)) - sqrt(dist(bins[i], x, y));
        if (cur_sv > sv) {
            idx = i;
            sv = cur_sv;
        }
    }
    return {idx, sv};
}

int main()
{
    ll ax, ay, bx, by;
    cin >> ax >> ay >> bx >> by >> tx >> ty;

    ll n;
    cin >> n;

    vector<pair<ll, ll>> bins(n); // x y
    for (ll i = 0; i < n; ++i) {
        cin >> bins[i].first >> bins[i].second;
    }

    double sv_a = 0;
    double sv_b = 0;

    double var1 = 0.0;
    {
        auto p1 = get_sv(bins, -1, ax, ay);// forbid, sv
        auto p2 = get_sv(bins, p1.first, bx, by);
        var1 = p1.second + p2.second;
    }

    double var2 = 0.0;
    {
        auto p1 = get_sv(bins, -1, bx, by);// forbid, sv
        auto p2 = get_sv(bins, p1.first, ax, ay);
        var2 = p1.second + p2.second;
    }

    double ans = 0.0;
    for (auto& b : bins) {
        ans += 2*sqrt(dist(b, tx, ty));
    }

    ans -= max(var1, var2);

    cout.precision(17);
    cout << ans << endl;

    return 0;
}


#include<bits/stdc++.h>

using namespace std;
typedef double dl;
typedef pair<dl,dl> pii;
vector<pii>v;
map<int,int>mp;
dl inf=123456789.00;
dl dis(pii a,pii b){
    return sqrt((a.first-b.first)*(a.first-b.first)+(a.second-b.second)*(a.second-b.second));
}
struct node{
    dl a,b,t,d1,d2;
    int in;
    bool operator<(const node& p)const{
        return max(p.d1,p.d2)<max(d1,d2);
    }
};
vector<node>vv;
int main(){
    dl a1,a2,b1,b2,t1,t2;
    cin>>a1>>a2>>b1>>b2>>t1>>t2;
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        dl x,y;
        scanf("%lf%lf",&x,&y);
        v.push_back(make_pair(x,y));
    }
    for(int i=0;i<v.size();i++){
        dl v1=dis(make_pair(a1,a2),v[i]);
        dl v2=dis(make_pair(b1,b2),v[i]);
        dl v3=dis(make_pair(t1,t2),v[i]);
        node nd;
        nd.a=v1+v3;
        nd.b=v2+v3;
        nd.t=2.0*v3;
        nd.d1=nd.t-nd.a;
        nd.d2=nd.t-nd.b;
        vv.push_back(nd);

    }
    sort(vv.begin(),vv.end());
    dl ans=0.0;
    int ck=0;
    dl s1=0.0,s2=0.0;
    for(int i=0;i<vv.size();i++){
        if(i==0){
            s1+=vv[i].a;
            s2+=vv[i].b;
        }else if(i==1){
            s1+=vv[i].b;
            s2+=vv[i].a;
        }
        else ans+=vv[i].t;
    }
    printf("%.10lf\n",ans+min(s1,s2));
}


#include<bits/stdc++.h>
using namespace std;
typedef double dl;
typedef pair<dl,dl> pii;
vector<pii>v;
map<int,int>mp;
dl inf=123456789.00;
dl dis(pii a,pii b){
    return sqrt((a.first-b.first)*(a.first-b.first)+(a.second-b.second)*(a.second-b.second));
}
struct node{
    dl a,b,t,d1;
    int in;
    bool operator<(const node& p)const{
        return p.d1<d1;
    }
};
vector<node>vv,vv1;
int main(){
    dl a1,a2,b1,b2,t1,t2;
    cin>>a1>>a2>>b1>>b2>>t1>>t2;
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        dl x,y;
        scanf("%lf%lf",&x,&y);
        v.push_back(make_pair(x,y));
    }
    for(int i=0;i<v.size();i++){
        dl v1=dis(make_pair(a1,a2),v[i]);
        dl v2=dis(make_pair(b1,b2),v[i]);
        dl v3=dis(make_pair(t1,t2),v[i]);
        node nd;
        nd.a=v1+v3;
        nd.b=v2+v3;
        nd.t=v3+v3;
        nd.d1=nd.t-nd.a;
        nd.in=i;
        vv.push_back(nd);
        nd.d1=nd.t-nd.b;
        vv1.push_back(nd);

    }
    sort(vv.begin(),vv.end());
//    for(int i=0;i<vv.size();i++){
//        cout<<vv[i].d1<<' ';
//    }
//    cout<<endl;
   // cout<<vv[0].a<<' '<<vv1[0].b<<endl;
    sort(vv1.begin(),vv1.end());
    if(n>=1){
        dl ans=0.0;
        int ck=0;
        dl s1=inf,s2=inf,s3=inf,s4=inf;
        //cout<<vv[0].in<<' '<<vv1[0].in<<' '<<vv[1].in<<' '<<vv1[1].in<<endl;
        if(vv[0].in==vv1[0].in){
            dl tp=vv[0].d1+vv1[1].d1;
            dl tp1=vv1[0].d1+vv[1].d1;
            s1=vv[0].a+vv1[1].b;
            s2=vv1[0].b+vv[1].a;
            if(tp>tp1){
                ans=s1;
                mp[vv[0].in]=1;
                mp[vv1[1].in]=1;
                for(int i=0;i<vv.size();i++){
                    if(!mp[vv[i].in])ans+=vv[i].t;
                    //  else cout<<vv[i].in<<' ';
                }

            }
            else if(tp==tp1){
                dl val1=s1,val2=s2;
                mp[vv[0].in]=1;
                mp[vv1[1].in]=1;
                for(int i=0;i<vv.size();i++){
                    if(!mp[vv[i].in])val1+=vv[i].t;
                }
                mp[vv[0].in]=0;
                mp[vv1[1].in]=0;
                mp[vv1[0].in]=1;
                mp[vv[1].in]=1;
                for(int i=0;i<vv.size();i++){
                    if(!mp[vv[i].in])val2+=vv[i].t;
                    //  else cout<<vv[i].in<<' ';
                }
                ans=min(val1,val2);
            }
            else{
                ans=s2;
                mp[vv1[0].in]=1;
                mp[vv[1].in]=1;
                for(int i=0;i<vv.size();i++){
                    if(!mp[vv[i].in])ans+=vv[i].t;
                }

            }
        }else{
            ans=vv[0].a+vv1[0].b;
            mp[vv[0].in]=1;
            mp[vv1[0].in]=1;
            for(int i=0;i<vv.size();i++){
                if(n==33)cout<<"masum"<<endl;
                if(!mp[vv[i].in])ans+=vv[i].t;
            }
        }
        printf("%.10lf\n",ans);
    }else{
        printf("%.10lf\n",min(vv[0].a,vv[0].b));
    }
}


#include<bits/stdc++.h>
using namespace std;
struct dot
{
	double x,y;
}A,B,T,D;
double dis(dot a,dot b)
{
	return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));
}
int n;
int main()
{
	cin>>A.x>>A.y>>B.x>>B.y>>T.x>>T.y;
	cin>>n;
	double sum=0;
	double fa=1e10,fb=1e10,fab=1e10;
	while(n--){
		scanf("%lf%lf",&D.x,&D.y);
		sum+=2*dis(D,T);
		double f=dis(A,D)-dis(D,T),g=dis(B,D)-dis(D,T);
		fab=min(fab,min(fa+g,fb+f));
		fa=min(fa,f);
		fb=min(fb,g);
	}
	printf("%.10lf\n",sum+min(fab,min(fa,fb)));
}


#include<bits/stdc++.h>
using namespace std;
typedef double dl;
typedef pair<dl,dl> pii;
vector<pii>v;
map<int,int>mp;
dl inf=123456789.00;
dl dis(pii a,pii b){
    return sqrt((a.first-b.first)*(a.first-b.first)+(a.second-b.second)*(a.second-b.second));
}
struct node{
    dl a,b,t,d1;
    int in;
    bool operator<(const node& p)const{
        return p.d1<d1;
    }
};
vector<node>vv,vv1;
int main(){
    dl a1,a2,b1,b2,t1,t2;
    cin>>a1>>a2>>b1>>b2>>t1>>t2;
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        dl x,y;
        scanf("%lf%lf",&x,&y);
        v.push_back(make_pair(x,y));
    }
    for(int i=0;i<v.size();i++){
        dl v1=dis(make_pair(a1,a2),v[i]);
        dl v2=dis(make_pair(b1,b2),v[i]);
        dl v3=dis(make_pair(t1,t2),v[i]);
        node nd;
        nd.a=v1+v3;
        nd.b=v2+v3;
        nd.t=v3+v3;
        nd.d1=nd.t-nd.a;
        nd.in=i;
        vv.push_back(nd);
        nd.d1=nd.t-nd.b;
        vv1.push_back(nd);

    }
    sort(vv.begin(),vv.end());
//    for(int i=0;i<vv.size();i++){
//        cout<<vv[i].d1<<' ';
//    }
//    cout<<endl;
    //cout<<vv[0].a<<' '<<vv1[0].a<<' '<<vv[1].b<<<<' '<<
    sort(vv1.begin(),vv1.end());
    if(n>=1){
        dl ans=0.0;
        int ck=0;
        dl s1=inf,s2=inf,s3=inf,s4=inf;
        //cout<<vv[0].in<<' '<<vv1[0].in<<' '<<vv[1].in<<' '<<vv1[1].in<<endl;
        if((vv[0].in==vv1[0].in) || (vv[1].in==vv1[1].in)){
            dl tp=vv[0].d1+vv1[1].d1;
            dl tp1=vv1[0].d1+vv[1].d1;
            s1=vv[0].a+vv1[1].b;
            s2=vv1[0].b+vv[1].a;
            if(tp>tp1){
                ans=s1;
                mp[vv[0].in]=1;
                mp[vv1[1].in]=1;
                for(int i=0;i<vv.size();i++){
                    if(!mp[vv[i].in])ans+=vv[i].t;
                    //  else cout<<vv[i].in<<' ';
                }

            }
            else if(tp==tp1){
                dl val1=s1,val2=s2;
                mp[vv[0].in]=1;
                mp[vv1[1].in]=1;
                for(int i=0;i<vv.size();i++){
                    if(!mp[vv[i].in])val1+=vv[i].t;
                }
                mp[vv[0].in]=0;
                mp[vv1[1].in]=0;
                mp[vv1[0].in]=1;
                mp[vv[1].in]=1;
                for(int i=0;i<vv.size();i++){
                    if(!mp[vv[i].in])val2+=vv[i].t;
                    //  else cout<<vv[i].in<<' ';
                }
                ans=min(val1,val2);
            }
            else{
                ans=s2;
                mp[vv1[0].in]=1;
                mp[vv[1].in]=1;
                for(int i=0;i<vv.size();i++){
                    if(!mp[vv[i].in])ans+=vv[i].t;
                }

            }
        }else{
            ans=vv[0].a+vv1[0].b;
            mp[vv[0].in]=1;
            mp[vv1[0].in]=1;
            for(int i=0;i<vv.size();i++){
                if(!mp[vv[i].in])ans+=vv[i].t;
            }
        }
        printf("%.10lf\n",ans);
    }else{
        printf("%.10lf\n",min(vv[0].a,vv[0].b));
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef double dl;
typedef pair<dl,dl> pii;
vector<pii>v;
map<int,int>mp;
dl inf=123456789.00;
dl dis(pii a,pii b){
    return sqrt((a.first-b.first)*(a.first-b.first)+(a.second-b.second)*(a.second-b.second));
}
struct node{
    dl a,b,t,d1;
    int in;
    bool operator<(const node& p)const{
        return p.d1<d1;
    }
};
vector<node>vv,vv1;
int main(){
    dl a1,a2,b1,b2,t1,t2;
    cin>>a1>>a2>>b1>>b2>>t1>>t2;
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        dl x,y;
        scanf("%lf%lf",&x,&y);
        v.push_back(make_pair(x,y));
    }
    for(int i=0;i<v.size();i++){
        dl v1=dis(make_pair(a1,a2),v[i]);
        dl v2=dis(make_pair(b1,b2),v[i]);
        dl v3=dis(make_pair(t1,t2),v[i]);
        node nd;
        nd.a=v1+v3;
        nd.b=v2+v3;
        nd.t=v3+v3;
        nd.d1=nd.t-nd.a;
        nd.in=i;
        vv.push_back(nd);
        nd.d1=nd.t-nd.b;
        vv1.push_back(nd);

    }
    sort(vv.begin(),vv.end());
//    for(int i=0;i<vv.size();i++){
//        cout<<vv[i].d1<<' ';
//    }
//    cout<<endl;
   // cout<<vv[0].a<<' '<<vv1[0].b<<endl;
    sort(vv1.begin(),vv1.end());
    if(n>=1){
        dl ans=0.0;
        int ck=0;
        dl s1=inf,s2=inf,s3=inf,s4=inf;
        //cout<<vv[0].in<<' '<<vv1[0].in<<' '<<vv[1].in<<' '<<vv1[1].in<<endl;
        if(vv[0].in==vv1[0].in){
            dl tp=vv[0].d1+vv1[1].d1;
            dl tp1=vv1[0].d1+vv[1].d1;
            s1=vv[0].a+vv1[1].b;
            s2=vv1[0].b+vv[1].a;
            if(tp>tp1){
                ans=s1;
                mp[vv[0].in]=1;
                mp[vv1[1].in]=1;
                for(int i=0;i<vv.size();i++){
                    if(!mp[vv[i].in])ans+=vv[i].t;
                    //  else cout<<vv[i].in<<' ';
                }

            }
            else if(tp==tp1){
                dl val1=s1,val2=s2;
                mp[vv[0].in]=1;
                mp[vv1[1].in]=1;
                for(int i=0;i<vv.size();i++){
                    if(!mp[vv[i].in])val1+=vv[i].t;
                }
                mp[vv[0].in]=0;
                mp[vv1[1].in]=0;
                mp[vv1[0].in]=1;
                mp[vv[1].in]=1;
                for(int i=0;i<vv.size();i++){
                    if(!mp[vv[i].in])val2+=vv[i].t;
                    //  else cout<<vv[i].in<<' ';
                }
                ans=min(val1,val2);
            }
            else{
                ans=s2;
                mp[vv1[0].in]=1;
                mp[vv[1].in]=1;
                for(int i=0;i<vv.size();i++){
                    if(!mp[vv[i].in])ans+=vv[i].t;
                }

            }
        }else{
            ans=vv[0].a+vv1[0].b;
            mp[vv[0].in]=1;
            mp[vv1[0].in]=1;
            for(int i=0;i<vv.size();i++){
                cout<<v[i].first<<' '<<v[i].second<<endl;
                if(!mp[vv[i].in])ans+=vv[i].t;
            }
        }
        printf("%.10lf\n",ans);
    }else{
        printf("%.10lf\n",min(vv[0].a,vv[0].b));
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef double dl;
typedef pair<dl,dl> pii;
vector<pii>v;
map<int,int>mp;
dl inf=123456789.00;
dl dis(pii a,pii b){
    return sqrt((a.first-b.first)*(a.first-b.first)+(a.second-b.second)*(a.second-b.second));
}
struct node{
    dl a,b,t,d1;
    int in;
    bool operator<(const node& p)const{
        return p.d1<d1;
    }
};
vector<node>vv,vv1;
int main(){
    dl a1,a2,b1,b2,t1,t2;
    cin>>a1>>a2>>b1>>b2>>t1>>t2;
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        dl x,y;
        scanf("%lf%lf",&x,&y);
        v.push_back(make_pair(x,y));
    }
    for(int i=0;i<v.size();i++){
        dl v1=dis(make_pair(a1,a2),v[i]);
        dl v2=dis(make_pair(b1,b2),v[i]);
        dl v3=dis(make_pair(t1,t2),v[i]);
        node nd;
        nd.a=v1+v3;
        nd.b=v2+v3;
        nd.t=v3+v3;
        nd.d1=nd.t-nd.a;
        nd.in=i;
        vv.push_back(nd);
        nd.d1=nd.t-nd.b;
        vv1.push_back(nd);

    }
    sort(vv.begin(),vv.end());
//    for(int i=0;i<vv.size();i++){
//        cout<<vv[i].d1<<' ';
//    }
//    cout<<endl;
    //cout<<vv[0].in<<' '<<vv1[0].in<<' '<<vv[1].in<<' '<<vv1[1].in<<endl;
    //cout<<vv[0].a<<' '<<vv1[0].a<<' '<<vv[1].b<<<<' '<<
    sort(vv1.begin(),vv1.end());
    if(n>=1){
        dl ans=0.0;
        int ck=0;
        dl s1=inf,s2=inf,s3=inf,s4=inf;
        if((vv[0].in==vv1[0].in) || (vv[1].in==vv1[1].in)){
            s1=vv[0].a+vv1[1].b;
            s2=vv1[0].b+vv[1].a;
            if(s1<=s2){
                ans=s1;
                mp[vv[0].in]=1;
                mp[vv1[1].in]=1;
            }else{
                ans=s2;
                mp[vv1[0].in]=1;
                mp[vv[1].in]=1;
            }
        }else{
            ans=vv[0].a+vv1[0].b;
            mp[vv[0].in]=1;
            mp[vv1[0].in]=1;
        }
        //cout<<ans<<endl;
        for(int i=0;i<vv.size();i++){
            if(!mp[vv[i].in])ans+=vv[i].t;
          //  else cout<<vv[i].in<<' ';
        }
        printf("%.10lf\n",ans);
    }else{
        printf("%.10lf\n",min(vv[0].a,vv[0].b));
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef double dl;
typedef pair<dl,dl> pii;
vector<pii>v;
map<int,int>mp;
dl inf=123456789.00;
dl dis(pii a,pii b){
    return sqrt((a.first-b.first)*(a.first-b.first)+(a.second-b.second)*(a.second-b.second));
}
struct node{
    dl a,b,t,d1;
    int in;
    bool operator<(const node& p)const{
        return p.d1<d1;
    }
};
vector<node>vv,vv1;
int main(){
    dl a1,a2,b1,b2,t1,t2;
    cin>>a1>>a2>>b1>>b2>>t1>>t2;
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        dl x,y;
        scanf("%lf%lf",&x,&y);
        v.push_back(make_pair(x,y));
    }
    for(int i=0;i<v.size();i++){
        dl v1=dis(make_pair(a1,a2),v[i]);
        dl v2=dis(make_pair(b1,b2),v[i]);
        dl v3=dis(make_pair(t1,t2),v[i]);
        node nd;
        nd.a=v1+v3;
        nd.b=v2+v3;
        nd.t=v3+v3;
        nd.d1=nd.t-nd.a;
        nd.in=i;
        vv.push_back(nd);
        nd.d1=nd.t-nd.b;
        vv1.push_back(nd);

    }
    sort(vv.begin(),vv.end());
//    for(int i=0;i<vv.size();i++){
//        cout<<vv[i].d1<<' ';
//    }
//    cout<<endl;
   // cout<<vv[0].a<<' '<<vv1[0].b<<endl;
    sort(vv1.begin(),vv1.end());
    if(n>=1){
        dl ans=0.0;
        int ck=0;
        dl s1=inf,s2=inf,s3=inf,s4=inf;
        //cout<<vv[0].in<<' '<<vv1[0].in<<' '<<vv[1].in<<' '<<vv1[1].in<<endl;
        if(vv[0].in==vv1[0].in){
            dl tp=vv[0].d1+vv1[1].d1;
            dl tp1=vv1[0].d1+vv[1].d1;
            s1=vv[0].a+vv1[1].b;
            s2=vv1[0].b+vv[1].a;
            if(tp>tp1){
                ans=s1;
                mp[vv[0].in]=1;
                mp[vv1[1].in]=1;
                for(int i=0;i<vv.size();i++){
                    if(!mp[vv[i].in])ans+=vv[i].t;
                    //  else cout<<vv[i].in<<' ';
                }

            }
            else if(tp==tp1){
                dl val1=s1,val2=s2;
                mp[vv[0].in]=1;
                mp[vv1[1].in]=1;
                for(int i=0;i<vv.size();i++){
                    if(!mp[vv[i].in])val1+=vv[i].t;
                }
                mp[vv[0].in]=0;
                mp[vv1[1].in]=0;
                mp[vv1[0].in]=1;
                mp[vv[1].in]=1;
                for(int i=0;i<vv.size();i++){
                    if(!mp[vv[i].in])val2+=vv[i].t;
                    //  else cout<<vv[i].in<<' ';
                }
                ans=min(val1,val2);
            }
            else{
                ans=s2;
                mp[vv1[0].in]=1;
                mp[vv[1].in]=1;
                for(int i=0;i<vv.size();i++){
                    if(!mp[vv[i].in])ans+=vv[i].t;
                }

            }
        }else{
            ans=vv[0].a+vv1[0].b;
            mp[vv[0].in]=1;
            mp[vv1[0].in]=1;
            for(int i=0;i<vv.size();i++){
                if(n==33)cout<<v[i].first<<' '<<v[i].second<<endl;
                if(!mp[vv[i].in])ans+=vv[i].t;
            }
        }
        printf("%.10lf\n",ans);
    }else{
        printf("%.10lf\n",min(vv[0].a,vv[0].b));
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef double dl;
typedef pair<dl,dl> pii;
vector<pii>v;
map<int,int>mp;
dl inf=123456789.00;
dl dis(pii a,pii b){
    return sqrt((a.first-b.first)*(a.first-b.first)+(a.second-b.second)*(a.second-b.second));
}
struct node{
    dl a,b,t,d1;
    int in;
    bool operator<(const node& p)const{
        return p.d1<d1;
    }
};
vector<node>vv,vv1;
int main(){
    dl a1,a2,b1,b2,t1,t2;
    cin>>a1>>a2>>b1>>b2>>t1>>t2;
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        dl x,y;
        scanf("%lf%lf",&x,&y);
        v.push_back(make_pair(x,y));
    }
    for(int i=0;i<v.size();i++){
        dl v1=dis(make_pair(a1,a2),v[i]);
        dl v2=dis(make_pair(b1,b2),v[i]);
        dl v3=dis(make_pair(t1,t2),v[i]);
        node nd;
        nd.a=v1+v3;
        nd.b=v2+v3;
        nd.t=v3+v3;
        nd.d1=nd.t-nd.a;
        nd.in=i;
        vv.push_back(nd);
        nd.d1=nd.t-nd.b;
        vv1.push_back(nd);

    }
    sort(vv.begin(),vv.end());
//    for(int i=0;i<vv.size();i++){
//        cout<<vv[i].d1<<' ';
//    }
//    cout<<endl;
    //cout<<vv[0].a<<' '<<vv1[0].a<<' '<<vv[1].b<<<<' '<<
    sort(vv1.begin(),vv1.end());
    if(n>=1){
        dl ans=0.0;
        int ck=0;
        dl s1=inf,s2=inf,s3=inf,s4=inf;
        //cout<<vv[0].in<<' '<<vv1[0].in<<' '<<vv[1].in<<' '<<vv1[1].in<<endl;
        if((vv[0].in==vv1[0].in) || (vv[1].in==vv1[1].in)){
            dl tp=vv[0].d1+vv1[1].d1;
            dl tp1=vv1[0].d1+vv[1].d1;
            s1=vv[0].a+vv1[1].b;
            s2=vv1[0].b+vv[1].a;
            if(tp>=tp1){
                ans=s1;
                mp[vv[0].in]=1;
                mp[vv1[1].in]=1;
            }else{
                ans=s2;
                mp[vv1[0].in]=1;
                mp[vv[1].in]=1;
            }
        }else{
            ans=vv[0].a+vv1[0].b;
            mp[vv[0].in]=1;
            mp[vv1[0].in]=1;
        }
        //cout<<ans<<endl;
        for(int i=0;i<vv.size();i++){
            if(!mp[vv[i].in])ans+=vv[i].t;
          //  else cout<<vv[i].in<<' ';
        }
        printf("%.10lf\n",ans);
    }else{
        printf("%.10lf\n",min(vv[0].a,vv[0].b));
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef double dl;
typedef pair<dl,dl> pii;
vector<pii>v;
map<int,int>mp;
dl inf=123456789.00;
dl dis(pii a,pii b){
    return sqrt((a.first-b.first)*(a.first-b.first)+(a.second-b.second)*(a.second-b.second));
}
struct node{
    dl a,b,t,d1;
    int in;
    bool operator<(const node& p)const{
        return p.d1<d1;
    }
};
vector<node>vv,vv1;
int main(){
    dl a1,a2,b1,b2,t1,t2;
    cin>>a1>>a2>>b1>>b2>>t1>>t2;
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        dl x,y;
        scanf("%lf%lf",&x,&y);
        v.push_back(make_pair(x,y));
    }
    for(int i=0;i<v.size();i++){
        dl v1=dis(make_pair(a1,a2),v[i]);
        dl v2=dis(make_pair(b1,b2),v[i]);
        dl v3=dis(make_pair(t1,t2),v[i]);
        node nd;
        nd.a=v1+v3;
        nd.b=v2+v3;
        nd.t=v3+v3;
        nd.d1=nd.t-nd.a;
        nd.in=i;
        vv.push_back(nd);
        nd.d1=nd.t-nd.b;
        vv1.push_back(nd);

    }
    sort(vv.begin(),vv.end());
//    for(int i=0;i<vv.size();i++){
//        cout<<vv[i].d1<<' ';
//    }
//    cout<<endl;
   // cout<<vv[0].a<<' '<<vv1[0].b<<endl;
    sort(vv1.begin(),vv1.end());
    if(n>=1){
        dl ans=0.0;
        int ck=0;
        dl s1=inf,s2=inf,s3=inf,s4=inf;
        //cout<<vv[0].in<<' '<<vv1[0].in<<' '<<vv[1].in<<' '<<vv1[1].in<<endl;
        if(vv[0].in==vv1[0].in){
            dl tp=vv[0].d1+vv1[1].d1;
            dl tp1=vv1[0].d1+vv[1].d1;
            s1=vv[0].a+vv1[1].b;
            s2=vv1[0].b+vv[1].a;
            if(tp>tp1){
                ans=s1;
                mp[vv[0].in]=1;
                mp[vv1[1].in]=1;
                for(int i=0;i<vv.size();i++){
                    if(!mp[vv[i].in])ans+=vv[i].t;
                    //  else cout<<vv[i].in<<' ';
                }

            }
            else if(tp==tp1){
                dl val1=s1,val2=s2;
                mp[vv[0].in]=1;
                mp[vv1[1].in]=1;
                for(int i=0;i<vv.size();i++){
                    if(!mp[vv[i].in])val1+=vv[i].t;
                }
                mp[vv[0].in]=0;
                mp[vv1[1].in]=0;
                mp[vv1[0].in]=1;
                mp[vv[1].in]=1;
                for(int i=0;i<vv.size();i++){
                    if(!mp[vv[i].in])val2+=vv[i].t;
                    //  else cout<<vv[i].in<<' ';
                }
                ans=min(val1,val2);
            }
            else{
                ans=s2;
                mp[vv1[0].in]=1;
                mp[vv[1].in]=1;
                for(int i=0;i<vv.size();i++){
                    if(!mp[vv[i].in])ans+=vv[i].t;
                }

            }
        }else{
            ans=vv[0].a+vv1[0].b;
            mp[vv[0].in]=1;
            mp[vv1[0].in]=1;
            for(int i=0;i<vv.size();i++){
                if(n==33){
                    printf("%10lf %10lf\n",v[i].first,v[i].second);
                }
                if(!mp[vv[i].in])ans+=vv[i].t;
            }
        }
        printf("%.10lf\n",ans);
    }else{
        printf("%.10lf\n",min(vv[0].a,vv[0].b));
    }
}


#include<bits/stdc++.h>
using namespace std;
typedef double dl;
typedef pair<dl,dl> pii;
vector<pii>v;
map<int,int>mp;
dl inf=123456789.00;
dl dis(pii a,pii b){
    return sqrt((a.first-b.first)*(a.first-b.first)+(a.second-b.second)*(a.second-b.second));
}
struct node{
    dl a,b,t,d1;
    int in;
    bool operator<(const node& p)const{
        return p.d1<d1;
    }
};
vector<node>vv,vv1;
int main(){
    dl a1,a2,b1,b2,t1,t2;
    cin>>a1>>a2>>b1>>b2>>t1>>t2;
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        dl x,y;
        scanf("%lf%lf",&x,&y);
        v.push_back(make_pair(x,y));
    }
    for(int i=0;i<v.size();i++){
        dl v1=dis(make_pair(a1,a2),v[i]);
        dl v2=dis(make_pair(b1,b2),v[i]);
        dl v3=dis(make_pair(t1,t2),v[i]);
        node nd;
        nd.a=v1+v3;
        nd.b=v2+v3;
        nd.t=v3+v3;
        nd.d1=nd.t-nd.a;
        nd.in=i;
        vv.push_back(nd);
        nd.d1=nd.t-nd.b;
        vv1.push_back(nd);

    }
    sort(vv.begin(),vv.end());
//    for(int i=0;i<vv.size();i++){
//        cout<<vv[i].d1<<' ';
//    }
//    cout<<endl;
   // cout<<vv[0].a<<' '<<vv1[0].b<<endl;
    sort(vv1.begin(),vv1.end());
    if(n>=1){
        dl ans=0.0;
        int ck=0;
        dl s1=inf,s2=inf,s3=inf,s4=inf;
        //cout<<vv[0].in<<' '<<vv1[0].in<<' '<<vv[1].in<<' '<<vv1[1].in<<endl;
        if(vv[0].in==vv1[0].in){
            dl tp=vv[0].d1+vv1[1].d1;
            dl tp1=vv1[0].d1+vv[1].d1;
            s1=vv[0].a+vv1[1].b;
            s2=vv1[0].b+vv[1].a;
            if(tp>tp1){
                ans=s1;
                mp[vv[0].in]=1;
                mp[vv1[1].in]=1;
                for(int i=0;i<vv.size();i++){
                    if(!mp[vv[i].in])ans+=vv[i].t;
                    //  else cout<<vv[i].in<<' ';
                }

            }
            else if(tp==tp1){
                dl val1=s1,val2=s2;
                mp[vv[0].in]=1;
                mp[vv1[1].in]=1;
                for(int i=0;i<vv.size();i++){
                    if(!mp[vv[i].in])val1+=vv[i].t;
                }
                mp[vv[0].in]=0;
                mp[vv1[1].in]=0;
                mp[vv1[0].in]=1;
                mp[vv[1].in]=1;
                for(int i=0;i<vv.size();i++){
                    if(!mp[vv[i].in])val2+=vv[i].t;
                    //  else cout<<vv[i].in<<' ';
                }
                ans=min(val1,val2);
            }
            else{
                ans=s2;
                mp[vv1[0].in]=1;
                mp[vv[1].in]=1;
                for(int i=0;i<vv.size();i++){
                    if(!mp[vv[i].in])ans+=vv[i].t;
                }

            }
        }else{
            ans=vv[0].a+vv1[0].b;
            mp[vv[0].in]=1;
            mp[vv1[0].in]=1;
            for(int i=0;i<vv.size();i++){
                if(!mp[vv[i].in])ans+=vv[i].t;
            }
        }
        printf("%.10lf\n",ans);
    }else{
        printf("%.10lf\n",min(vv[0].a,vv[0].b));
    }
}


#include <bits/stdc++.h>

#define rep(i,j,k) for(int i = (int) j; i < (int) k; ++i)
#define mp make_pair
#define ll long long
#define db double
#define P pair<int, int >
using namespace std;
const db eps = 1e-8;
inline int sig(db x) {return (x > eps) - (x < -eps);}
const int N = 100100;
P p[N];
P a, b, t;
int n;

inline void in(const P& z) {scanf("%d %d", &z.first, &z.second); }

inline db sqr(int x) {return 1.*x*x;}

inline db dist(P u, P v) {
    return sqrt(sqr(u.first-v.first) + sqr(u.second-v.second));
}

pair<db, db > sv[N];
db d;

inline void init() {
    d = 0;
    rep(i, 0, n) {
        db dia = dist(a, p[i]);
        db dib = dist(b, p[i]);
        db dit = dist(t, p[i]);
        d += dit + dit;
        sv[i].first = dit - dia;
        sv[i].second = dit - dib;
    }
    return ;
}

void solve() {
    init();
    sort(sv, sv+n);
    db mx = 1e-18;
    for(int i = n-1; i >= 0; --i) {
        mx = max(mx, sv[i].first);
        mx = max(mx, sv[i].second);
        if(i==n-1) mx = max(mx, sv[i-1].first+sv[i].second);
        else mx = max(mx, sv[n-1].first+sv[i].second);
    }
    printf("%.8f\n", d-mx);

}

void out(P z) {printf("(%d %d)\n", z.first, z.second); }

int main()
{
#ifdef PIT
freopen("671a.in", "r", stdin);
//freopen(".out", "w", stdout);
#endif // PIT

    in(a); in(b); in(t);
    scanf("%d", &n);
    rep(i, 0, n) in(p[i]);
    solve();
    return 0;
}


#include <bits/stdc++.h>

#define rep(i, j, k) for(int i = (int) j; i < (int) k; ++i)
#define ll long long
#define mp make_pair
#define fi first
#define se second

using namespace std;

const int N = 100100;

pair<double, double > t[N];
double d;
int ax, ay, bx, by, tx, ty;
int n;

double dist(int a, int b, int x, int y) {
    return sqrt(1.*(a-x)*(a-x) + 1.*(b-y)*(b-y));
}

void in() {
    scanf("%d %d %d %d %d %d", &ax, &ay, &bx, &by, &tx, &ty);
    scanf("%d", &n);
    int x, y;
    d = 0;
    rep(i, 0, n) {
        scanf("%d %d", &x, &y);
        double da, db, dt;
        da = dist(ax, ay, x, y);
        db = dist(bx, by, x, y);
        dt = dist(tx, ty, x, y);
        d += dt + dt;
        t[i] = {dt-da, dt-db};
    }
    sort(t, t+n);
    return ;
}

void solve() {
    double mx = 1e-16;
    for(int i = n-1; i >= 0; --i) {
        mx = max(mx, t[i].fi);
        mx = max(mx, t[i].se);
        if(i == n-1) mx = max(mx, t[i-1].fi+t[i].se);
        else mx = max(mx, t[n-1].fi+t[i].se);
    }
    printf("%.8f\n", d-mx);
    return ;
}

int main()
{
#ifdef PIT
//freopen("", "r", stdin);
#endif // PIT
    in();
    solve();
    return 0;
}