#include <bits/stdc++.h>
double dt1, dt2, delt, t1, t2;
std::pair<double, double> c, h, s, p;
double d1[2 * 60], d2[2 * 60];
inline double dist(std::pair<double, double> a, std::pair<double, double> b) {
  return sqrt((a.first - b.first) * (a.first - b.first) +
              (a.second - b.second) * (a.second - b.second));
}
inline double min2(double a, double b) { return a < b ? a : b; }
double score(std::pair<double, double> p) {
  double a, b;
  a = t1 + dt1 - dist(p, h);
  if (a < dist(c, p) - 1E-5) return -1;
  b = t2 + dt2 - dist(p, s) - dist(s, h);
  if (b < dist(c, p) - 1E-5) return -1;
  return min2(a, b);
}
double score2(std::pair<double, double> p) {
  double a, b;
  a = t1 + dt1 - dist(p, h);
  if (a < dist(c, p) - 1E-5) return -1;
  b = t2 + dt2 - dist(p, h);
  if (b < dist(c, p) - 1E-5) return -1;
  return min2(a, b);
}
double solve(double *d1, double *d2) {
  delt = 1;
  p = c;
  char g;
  int i;
  std::pair<double, double> np;
  while (delt > 1E-5) {
    g = 0;
    for (i = 0; i < 60 && g == 0; i++) {
      np = std::make_pair(p.first + delt * d1[i], p.second + delt * d2[i]);
      if (score(np) > score(p) + 1E-5) p = np, g = 1;
    }
    if (!g) delt *= 0.7;
  }
  return score(p);
}
double solve2(double *d1, double *d2) {
  delt = 1;
  p = c;
  char g;
  int i;
  std::pair<double, double> np;
  while (delt > 1E-5) {
    g = 0;
    for (i = 0; i < 60 && g == 0; i++) {
      np = std::make_pair(p.first + delt * d1[i], p.second + delt * d2[i]);
      if (score2(np) > score2(p) + 1E-5) p = np, g = 1;
    }
    if (!g) delt *= 0.7;
  }
  return score2(p);
}
int main() {
  double rez;
  scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &dt2, &dt1, &c.first, &c.second, &h.first,
        &h.second, &s.first, &s.second);
  t1 = dist(c, h);
  t2 = dist(c, s) + dist(s, h);
  for (int i = 0; i < 60; i++) {
    d1[i] = cos(2 * i * 3.141592653589793 / 60);
    d2[i] = sin(2 * i * 3.141592653589793 / 60);
  }
  for (int i = 60; i < 2 * 60; i++) {
    d1[i] = d1[i - 60];
    d2[i] = d2[i - 60];
  }
  if (dt1 != 0 && dt2 != 0) {
    double aux, ca;
    rez = 0;
    for (int i = 0; i < 60; i++) {
      aux = solve(d1 + i, d2 + i);
      if (rez < aux) rez = aux;
    }
    if (dist(c, s) + dist(s, h) <= t1 + dt1) {
      double cr = dist(c, s);
      t1 -= dist(c, s);
      t2 -= dist(c, s);
      c = s;
      ca = 0;
      for (int i = 0; i < 60; i++) {
        aux = solve2(d1 + i, d2 + i);
        if (ca < aux) ca = aux;
      }
      cr += ca;
      if (cr > rez) rez = cr;
    }
    printf("%.12lf", rez);
  } else {
    double ang;
    std::pair<double, double> np;
    if (dt1 == 0) {
      if (dist(c, s) + dist(s, h) < t1 + dt1 + 1E-5)
        rez = t2;
      else {
        ang = atan2(h.second - c.second, h.first - c.first);
        delt = 1;
        p = c;
        rez = 0;
        while (delt > 1E-5) {
          np = std::make_pair(p.first + delt * cos(ang),
                              p.second + delt * sin(ang));
          if (rez + delt < t1 + 1E-5 &&
              dist(c, np) + dist(np, s) + dist(s, h) < t2 + dt2 + 1E-5)
            p = np, rez += delt;
          else
            delt *= 0.7;
        }
      }
    } else {
      if (dist(c, s) + dist(s, h) < t1 + dt1 + 1E-5)
        rez = t2;
      else {
        ang = atan2(s.second - c.second, s.first - c.first);
        delt = 1;
        p = c;
        rez = 0;
        while (delt > 1E-5) {
          np = std::make_pair(p.first + delt * cos(ang),
                              p.second + delt * sin(ang));
          if (rez + delt < dist(c, s) + 1E-5 &&
              dist(c, np) + dist(np, h) < t1 + dt1 + 1E-5)
            p = np, rez += delt;
          else
            delt *= 0.7;
        }
      }
    }
    printf("%.12lf", rez);
  }
  return 0;
}
