#include <bits/stdc++.h>
using namespace std;
long double disnance(pair<int, int> &fr, pair<int, int> &sc) {
  long double tmp = pow(
      pow(fr.first - sc.first, 2.0) + pow(fr.second - sc.second, 2.0), 1 / 2.0);
  return tmp;
}
int main() {
  pair<int, int> adil, bera, yrna;
  vector<pair<int, int>> butilki_s_pivasikom_nu_a_s_chem_zhe_eshe;
  int n;
  long double ans = 1e16;
  scanf("%d %d %d %d %d %d", &adil.first, &adil.second, &bera.first,
        &bera.second, &yrna.first, &yrna.second);
  scanf("%d", &n);
  butilki_s_pivasikom_nu_a_s_chem_zhe_eshe.resize(n);
  for (int i = 0; i < n; i++)
    scanf("%d %d", &butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[i].first,
          &butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[i].second);
  long double predpr = 0.0;
  for (int i = 0; i < n; i++) {
    long double tmp =
        disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[i], yrna);
    predpr += 2 * tmp;
  }
  long double kadil_first = 1e16, kadil_second = 1e16, babera_first = 1e16,
              babera_second = 1e16;
  int kadil_index_first = 0, kadil_index_second = 0;
  int babera_index_first = 0, babera_index_second = 0;
  for (int i = 0; i < n; i++) {
    long double kadil_do =
        predpr - disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[i], yrna) +
        disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[i], adil);
    long double babera_do =
        predpr - disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[i], yrna) +
        disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[i], bera);
    if (kadil_do < kadil_first) {
      kadil_second = kadil_first;
      kadil_index_second = kadil_index_first;
      kadil_first = kadil_do;
      kadil_index_first = i;
    } else if (kadil_do < kadil_second) {
      kadil_second = kadil_do;
      kadil_index_second = i;
    }
    if (babera_do < babera_first) {
      babera_second = babera_first;
      babera_index_second = babera_index_first;
      babera_first = babera_do;
      babera_index_first = i;
    } else if (babera_do < babera_second) {
      babera_second = babera_do;
      babera_index_second = i;
    }
  }
  long double hodka = 1e16;
  long double tmp =
      predpr -
      disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[kadil_index_first],
               yrna) +
      disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[kadil_index_first],
               adil);
  hodka = min(hodka, tmp);
  tmp = predpr -
        disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[babera_index_first],
                 yrna) +
        disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[babera_index_first],
                 bera);
  hodka = min(hodka, tmp);
  if (babera_index_first != kadil_index_first) {
    tmp = predpr -
          disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[babera_index_first],
                   yrna) +
          disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[babera_index_first],
                   bera) -
          disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[kadil_index_first],
                   yrna) +
          disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[kadil_index_first],
                   adil);
    hodka = min(hodka, tmp);
  }
  if (babera_index_first != kadil_index_second) {
    tmp = predpr -
          disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[babera_index_first],
                   yrna) +
          disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[babera_index_first],
                   bera) -
          disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[kadil_index_second],
                   yrna) +
          disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[kadil_index_second],
                   adil);
    hodka = min(hodka, tmp);
  }
  if (babera_index_second != kadil_index_first) {
    tmp =
        predpr -
        disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[babera_index_second],
                 yrna) +
        disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[babera_index_second],
                 bera) -
        disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[kadil_index_first],
                 yrna) +
        disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[kadil_index_first],
                 adil);
    hodka = min(hodka, tmp);
  }
  if (babera_index_second != kadil_index_second) {
    tmp =
        predpr -
        disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[babera_index_second],
                 yrna) +
        disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[babera_index_second],
                 bera) -
        disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[kadil_index_second],
                 yrna) +
        disnance(butilki_s_pivasikom_nu_a_s_chem_zhe_eshe[kadil_index_second],
                 adil);
    hodka = min(hodka, tmp);
  }
  cout << setprecision(9) << fixed << hodka;
  return 0;
}
