#include <bits/stdc++.h>
using namespace std;
const double ep = 1e-10;
struct pnt {
  double x, y;
  pnt(double x = 0, double y = 0) : x(x), y(y) {}
  pnt operator-(pnt a) { return pnt(x - a.x, y - a.y); }
  pnt operator/(double a) { return pnt(x / a, y / a); }
  pnt operator+(pnt a) { return pnt(x + a.x, y + a.y); }
  pnt operator*(double a) { return pnt(x * a, y * a); }
  pnt rot() { return pnt(-y, x); }
  double dist() { return sqrt(x * x + y * y); }
  void input() { scanf("%lf %lf", &x, &y); }
} C, H, S, O[3];
double th, ts, dh, dhs, ds;
double r[3];
int inter_circle(pnt c1, double r1, pnt c2, double r2, pnt *rlt) {
  double d = (c1 - c2).dist();
  if (r1 + r2 + ep < d || r1 + d + ep < r2 || r2 + d + ep < r1) return 0;
  double x = (r1 * r1 - r2 * r2 + d * d) / (d * 2);
  pnt cp = (c1 * (d - x) + c2 * x) / d;
  if (fabs(r1 + r2 - d) < ep || fabs(r1 + d - r2) < ep ||
      fabs(r2 + d - r1) < ep) {
    rlt[0] = cp;
    return 1;
  }
  double h = sqrt(r1 * r1 - x * x);
  pnt dv = (c2 - c1).rot() * h / d;
  rlt[0] = cp - dv, rlt[1] = cp + dv;
  return 2;
}
bool check(double mid) {
  r[0] = mid, O[0] = C;
  r[1] = ts - dhs - mid, O[1] = S;
  r[2] = th - mid, O[2] = H;
  for (int i = 0; i < 3; i++)
    if (abs(r[i]) < ep) r[i] = 0;
  if (r[0] < 0 || r[1] < 0 || r[2] < 0) return 0;
  pnt rlt[5];
  vector<pnt> vec;
  for (int i = 0; i < 3; i++) {
    vec.push_back(O[i]);
    int j = (i + 1) % 3;
    int k = inter_circle(O[i], r[i], O[j], r[j], rlt);
    for (int jj = 0; jj < k; jj++) vec.push_back(rlt[jj]);
  }
  for (auto x : vec) {
    bool flag = 0;
    for (int i = 0; i < 3; i++) {
      if ((O[i] - x).dist() > r[i] + ep) flag = 1;
    }
    if (!flag) return 1;
  }
  return 0;
}
int main() {
  scanf("%lf %lf", &ts, &th);
  C.input();
  H.input();
  S.input();
  H = H - C, S = S - C, C = pnt(0, 0);
  dh = H.dist(), ds = S.dist(), dhs = (H - S).dist();
  th += dh;
  ts += ds + dhs;
  double ans = 0;
  if (th > ds + dhs - ep)
    ans = max(ans, min(th, ts));
  else {
    double st = 0, en = 400;
    while (en - st > ep) {
      double mid = (en + st) / 2;
      if (check(mid))
        st = mid;
      else
        en = mid;
    }
    ans = st;
  }
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}
