#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
double t1, t2, d1, d2;
complex<double> cinema, home, shop;
void ReadData(complex<double> &a) {
  double x, y;
  scanf("%lf%lf", &x, &y);
  a = complex<double>(x, y);
}
double Dist(complex<double> x, complex<double> y) { return abs(x - y); }
bool cmp(pair<complex<double>, double> c1, pair<complex<double>, double> c2) {
  if (c1.first.real() < c2.first.real()) return true;
  if (c1.first.real() > c2.first.real()) return false;
  if (c1.first.imag() < c2.first.imag()) return true;
  if (c1.first.imag() > c2.first.imag()) return false;
  if (c1.second < c2.second) return true;
  return false;
}
bool InCircle(pair<complex<double>, double> c1,
              pair<complex<double>, double> c2) {
  double a = Dist(c1.first, c2.first) + c1.second;
  double b = c2.second;
  return a < b + eps;
}
bool IsInsect(pair<complex<double>, double> c1,
              pair<complex<double>, double> c2) {
  return Dist(c1.first, c2.first) < c1.second + c2.second + eps;
}
bool InPoint(complex<double> p, pair<complex<double>, double> c) {
  return Dist(p, c.first) < c.second + eps;
}
complex<double> GetNew(complex<double> e1, complex<double> e2,
                       complex<double> p, complex<double> c) {
  double a = c.real() - p.real();
  double b = c.imag() - p.imag();
  double x = a * e1.real() + b * e2.real();
  double y = a * e1.imag() + b * e2.imag();
  return complex<double>(x, y);
}
complex<double> GetOld(complex<double> e1, complex<double> e2,
                       complex<double> p, complex<double> c) {
  double a = c.real();
  double b = c.imag();
  double x = a * e1.real() + b * e1.imag();
  double y = a * e2.real() + b * e2.imag();
  x += p.real();
  y += p.imag();
  return complex<double>(x, y);
}
vector<complex<double> > GetInsect(pair<complex<double>, double> c1,
                                   pair<complex<double>, double> c2) {
  complex<double> p = c1.first;
  complex<double> e1 = c2.first - c1.first;
  e1 = e1 / abs(e1);
  complex<double> e2 = complex<double>(e1.imag(), -e1.real());
  complex<double> A = GetNew(e1, e2, p, c1.first);
  complex<double> B = GetNew(e1, e2, p, c2.first);
  double r1 = c1.second * c1.second;
  double r2 = c2.second * c2.second;
  double b = B.real();
  double x = (b * b + r1 - r2) / (2.0 * b);
  double y = r1 - x * x;
  if (y < 0.0) y = 0.0;
  vector<complex<double> > ret;
  if (y < eps)
    ret.push_back(complex<double>(x, y));
  else {
    ret.push_back(complex<double>(x, sqrt(y)));
    ret.push_back(complex<double>(x, -sqrt(y)));
  }
  for (int i = 0; i < (int)ret.size(); i++) ret[i] = GetOld(e1, e2, p, ret[i]);
  return ret;
}
bool Insect3Circles(vector<pair<complex<double>, double> > &circles) {
  sort(circles.begin(), circles.end(), cmp);
  do {
    if (!IsInsect(circles[0], circles[1])) return false;
    if (InCircle(circles[0], circles[1]))
      if (IsInsect(circles[0], circles[2]))
        return true;
      else
        return false;
  } while (next_permutation(circles.begin(), circles.end(), cmp));
  sort(circles.begin(), circles.end(), cmp);
  do {
    vector<complex<double> > pis = GetInsect(circles[0], circles[1]);
    bool flag = false;
    for (int i = 0; i < (int)pis.size(); i++)
      if (InPoint(pis[i], circles[2])) {
        flag = true;
        break;
      }
    if (flag) return true;
  } while (next_permutation(circles.begin(), circles.end(), cmp));
  return false;
}
bool check(double r) {
  vector<pair<complex<double>, double> > circles(3);
  circles[0] = pair<complex<double>, double>(cinema, r);
  circles[1] =
      pair<complex<double>, double>(shop, max(0.0, d1 - Dist(shop, home) - r));
  circles[2] = pair<complex<double>, double>(home, max(0.0, d2 - r));
  return Insect3Circles(circles);
}
int main() {
  cin >> t1 >> t2;
  ReadData(cinema);
  ReadData(home);
  ReadData(shop);
  d1 = t1 + Dist(cinema, shop) + Dist(shop, home);
  d2 = t2 + Dist(cinema, home);
  if (Dist(cinema, shop) + Dist(shop, home) < d2 + eps) {
    double ans = min(d1, d2);
    printf("%.9lf\n", ans);
    return 0;
  }
  double l = 0.0, r = min(d1, d2);
  for (int step = 0; step <= 40; step++) {
    double m = (l + r) / 2.0;
    if (check(m))
      l = m;
    else
      r = m;
  }
  double ans = (l + r) / 2.0;
  printf("%.9lf\n", ans);
  return 0;
}
