#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-10;
struct point {
  double x, y;
  point() { x = y = 0.0; }
  point(double x, double y) : x(x), y(y) {}
};
struct circle {
  double r;
  point O;
  circle() { O.x = O.y = r = 0.0; }
  circle(point O, double r) : O(O), r(r) {}
  point ang(double a) { return point(O.x + cos(a) * r, O.y + sin(a) * r); }
};
point operator-(point a, point b) { return point(a.x - b.x, a.y - b.y); }
double dist(point a) { return sqrt(a.x * a.x + a.y * a.y); }
double t1, t2, d1, d2, d3;
point a, b, c, D, E;
circle A, B, C;
int dcmp(double a) {
  if (fabs(a) < eps) return 0;
  return a > eps ? 1 : -1;
}
double angle(point v) { return atan2(v.y, v.x); }
int flag;
bool jiao(circle C1, circle C2) {
  flag = 0;
  double d = dist(C1.O - C2.O);
  if (dcmp(C1.r + C2.r - d) < 0) return false;
  if (dcmp(C1.r - C2.r - d) > 0) {
    flag = 1;
    return false;
  }
  if (dcmp(C2.r - C1.r - d) > 0) {
    flag = 2;
    return false;
  }
  double a = angle(C2.O - C1.O);
  double da =
      acos((C1.r * C1.r + d * d - C2.r * C2.r) / (2 * C1.r * d) - 1e-12);
  D = C1.ang(a - da), E = C1.ang(a + da);
  return true;
}
int aa, bb, cc;
bool check(double x) {
  A = circle(a, x);
  B = circle(b, d1 + t1 - x);
  C = circle(c, d2 + t2 - x);
  aa = 0, bb = 0, cc = 0;
  if (jiao(A, B)) {
    if (dcmp(C.r - dist(D - C.O)) >= 0) return true;
    if (dcmp(C.r - dist(E - C.O)) >= 0) return true;
  }
  if (flag == 1) bb++;
  if (flag == 2) aa++;
  if (jiao(A, C)) {
    double dis = dist(D - C.O);
    if (dcmp(B.r - dist(D - B.O)) >= 0) return true;
    if (dcmp(B.r - dist(E - B.O)) >= 0) return true;
  }
  if (flag == 1) cc++;
  if (flag == 2) aa++;
  if (jiao(B, C)) {
    if (dcmp(A.r - dist(D - A.O)) >= 0) return true;
    if (dcmp(A.r - dist(E - A.O)) >= 0) return true;
  }
  if (flag == 1) cc++;
  if (flag == 2) bb++;
  if (aa == 2 || bb == 2 || cc == 2) return true;
  return false;
}
int main() {
  scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &t1, &t2, &a.x, &a.y, &c.x, &c.y,
        &b.x, &b.y);
  d1 = dist(a - b);
  d2 = dist(a - c), d3 = dist(b - c);
  double l = 0, r = min(d1 + t1, d2 + t2), m;
  while (dcmp(l - r)) {
    double m = (l + r) / 2.0;
    if (check(m))
      l = m;
    else
      r = m - eps;
  }
  if (dcmp(d1 + d3 - t2 - d2) <= 0) l = min(d2 + t2, d1 + d3 + t1);
  printf("%.9lf\n", l);
  return 0;
}
