#include <bits/stdc++.h>
using namespace std;
struct point {
  double x, y;
  point() {}
  point(double _x, double _y) : x(_x), y(_y) {}
} c, s, h;
double t1, t2;
double dstc(point &x, point &y) {
  return sqrt(((x.x - y.x) * (x.x - y.x)) + ((x.y - y.y) * (x.y - y.y)));
}
double calc(double m) {
  point a = point(s.x * (1 - m) + h.x * m, s.y * (1 - m) + h.y * m);
  point b;
  double ac = dstc(a, c);
  double ah = dstc(a, h);
  double as = dstc(s, a);
  if (ac + ah <= t2 && ac + as <= t1) {
    return min(t2 - ah, t1 - as);
  }
  double l = 0, r = 1, mid, la, lb, lc;
  for (int i = 0; i < 300; i++) {
    mid = (l + r) / 2;
    b = point(c.x * (1 - mid) + a.x * mid, c.y * (1 - mid) + a.y * mid);
    la = dstc(b, c);
    lb = dstc(b, h);
    lc = dstc(b, s);
    if (la + lb <= t2 && la + lc <= t1)
      l = mid;
    else
      r = mid;
  }
  b = point(c.x * (1 - l) + a.x * l, c.y * (1 - l) + a.y * l);
  return dstc(b, c);
}
int main() {
  cin >> t1 >> t2 >> c.x >> c.y >> h.x >> h.y >> s.x >> s.y;
  double la, lb, lc;
  la = dstc(c, s);
  lb = dstc(c, h);
  lc = dstc(s, h);
  if (lb + t2 >= la + lc) {
    printf("%.10lf\n", min(lb + t2, la + lc + t1));
    return 0;
  }
  t1 += la + 1e-10;
  t2 += lb + 1e-10;
  double l = 0, r = 1, lm, rm, res = 0, v1, v2;
  for (int i = 0; i < 300; i++) {
    lm = (2 * l + r) / 3.0, rm = (2 * r + l) / 3.0;
    v1 = calc(lm), v2 = calc(rm);
    res = max(res, max(v1, v2));
    if (v1 < v2)
      l = lm;
    else
      r = rm;
  }
  printf("%.10lf\n", res);
}
