#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
int t1, t2;
int xa, ya, xb, yb, xc, yc;
double T1, T2, tbc;
bool in(double x, double y, double x0, double y0, double r) {
  double d = hypot(x - x0, y - y0);
  return d <= r + eps;
}
bool common(double x0, double y0, double r0, double x1, double y1, double r1) {
  double d = hypot(x0 - x1, y0 - y1);
  return d <= r0 + r1 + eps;
}
bool test(double x0, double y0, double r0, double x1, double y1, double r1,
          double x2, double y2, double r2) {
  double d = hypot(x0 - x1, y0 - y1);
  if (d > r0 + r1 + eps) return 0;
  if (fabs(r0 - r1) + eps >= d)
    return r0 < r1 ? common(x0, y0, r0, x2, y2, r2)
                   : common(x1, y1, r1, x2, y2, r2);
  double t = acos((d * d + r0 * r0 - r1 * r1) / 2 / r0 / d),
         t0 = atan2(y1 - y0, x1 - x0);
  if (d + eps > r0 + r1) t = 0;
  double xa = x0 + r0 * cos(t + t0), ya = y0 + r0 * sin(t + t0),
         xb = x0 + r0 * cos(t0 - t), yb = y0 + r0 * sin(t0 - t);
  return in(xa, ya, x2, y2, r2) || in(xb, yb, x2, y2, r2);
}
bool check(double x) {
  if (x + tbc > T1 + eps) return 0;
  double ra = x, rb = T1 - tbc - x, rc = T2 - x;
  if (rb < eps) return in(xb, yb, xa, ya, ra) && in(xb, yb, xc, yc, rc);
  return test(xa, ya, ra, xb, yb, rb, xc, yc, rc) ||
         test(xa, ya, ra, xc, yc, rc, xb, yb, rb) ||
         test(xb, yb, rb, xc, yc, rc, xa, ya, ra);
}
int main() {
  scanf("%d%d%d%d%d%d%d%d", &t1, &t2, &xa, &ya, &xc, &yc, &xb, &yb);
  tbc = hypot(xc - xb, yc - yb);
  T1 = hypot(xb - xa, yb - ya) + tbc + t1;
  T2 = hypot(xc - xa, yc - ya) + t2;
  if (T1 - t1 <= T2 + eps) return printf("%.10lf\n", min(T1, T2)), 0;
  double l = 0, r = min(T1, T2);
  while (r - l > eps) {
    double mid = l * 0.5 + r * 0.5;
    if (check(mid))
      l = mid;
    else
      r = mid;
  }
  printf("%.10lf\n", l);
  return 0;
}
