#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
inline void get(complex<double> &a) {
  double x, y;
  cin >> x >> y;
  a = complex<double>(x, y);
}
bool intersect(complex<double> a, double ra, complex<double> b, double rb,
               complex<double> c, double rc) {
  if (abs(a - b) > ra + rb + eps) return false;
  if (abs(a - c) < ra - eps && abs(b - c) < rb - eps) return true;
  if (abs(a - b) < abs(ra - rb) - eps) return false;
  b -= a, c -= a;
  complex<double> i = complex<double>(b.real() / abs(b), b.imag() / abs(b));
  b /= i, c /= i;
  double x = (ra * ra + abs(b) * abs(b) - rb * rb) / (2 * abs(b));
  double h = sqrt(max(ra * ra - x * x, 0.0));
  complex<double> p = complex<double>(x, h), q = complex<double>(x, -h);
  if (min(abs(p - c), abs(q - c)) < rc + eps) return true;
  return false;
}
bool eval(complex<double> a, double ra, complex<double> b, double rb,
          complex<double> c, double rc) {
  if (ra < eps || rb < eps || rc < eps) return false;
  if (intersect(a, ra, b, rb, c, rc)) return true;
  if (intersect(a, ra, c, rc, b, rb)) return true;
  if (intersect(b, rb, c, rc, a, ra)) return true;
  return false;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  double t1, t2;
  complex<double> a, b, c;
  cin >> t1 >> t2;
  get(a), get(b), get(c);
  double ab = abs(a - b), ac = abs(a - c), bc = abs(b - c);
  if (ab + t2 > ac + bc - eps) {
    cout << fixed << setprecision(5) << min(ab + t2, ac + bc + t1) << '\n';
    return 0;
  }
  double l = 0, r = min(ab + t2, ac + t1);
  while (fabs(r - l) > eps) {
    double m = (l + r) * 0.5;
    if (eval(a, m, b, ab + t2 - m, c, ac + t1 - m))
      l = m;
    else
      r = m;
  }
  cout << fixed << setprecision(5) << (l + r) * 0.5 << '\n';
}
