#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-14;
inline long double sqr(long double x) { return x * x; }
inline int sgn(long double x) { return fabs(x) < eps ? 0 : x > 0 ? 1 : -1; }
struct point {
  long double x, y;
};
inline point operator-(point a, point b) {
  return (point){a.x - b.x, a.y - b.y};
}
inline point operator+(point a, point b) {
  return (point){a.x + b.x, a.y + b.y};
}
inline point operator*(point a, long double l) {
  return (point){a.x * l, a.y * l};
}
inline long double sModular(point a) { return sqr(a.x) + sqr(a.y); }
inline point identity(point a) {
  long double m = sqrt(sModular(a));
  return a * (1.0 / m);
}
struct circle {
  point p;
  long double r;
};
inline bool inside(circle a, point p) {
  return sgn(sModular(a.p - p) - sqr(a.r)) <= 0;
}
inline bool inside(circle a, circle b) {
  long double sqDis = sModular(a.p - b.p);
  return sgn(b.r - a.r) < 0 && sgn(sqDis - sqr(a.r - b.r)) < 0;
}
inline bool intersect(circle &a, circle &b, point &x, point &y) {
  long double sqDis = sModular(a.p - b.p);
  if (sgn(sqDis - sqr(a.r + b.r)) > 0) return false;
  long double dPar = (sqr(a.r) - sqr(b.r) + sqDis) / (2.0 * sqrt(sqDis)),
              dHor = sqrt(max((long double)0, sqr(a.r) - sqr(dPar)));
  point i = identity(b.p - a.p), j = (point){i.y, -i.x};
  x = a.p + i * dPar + j * dHor;
  y = a.p + i * dPar - j * dHor;
  return true;
}
inline bool _intersect(circle &a, circle &b, circle &c) {
  point x, y;
  if (inside(a, b)) return intersect(b, c, x, y);
  if (inside(b, a)) return intersect(a, c, x, y);
  if (!intersect(a, b, x, y)) return false;
  return inside(c, x) || inside(c, y);
}
inline bool intersect(circle a, circle b, circle c) {
  return _intersect(a, b, c) || _intersect(a, c, b) || _intersect(b, c, a);
}
point C, S, H;
long double T1, T2, dHS;
inline bool check(long double x) {
  circle CC = (circle){C, x},
         CS = (circle){S, max((long double)0, T1 - x - dHS)},
         CH = (circle){H, max((long double)0, T2 - x)};
  return intersect(CC, CS, CH);
}
int main() {
  long double t1, t2;
  cin >> t1 >> t2 >> C.x >> C.y >> H.x >> H.y >> S.x >> S.y;
  T1 = sqrt(sModular(S - C)) + sqrt(sModular(H - S)) + t1;
  T2 = sqrt(sModular(C - H)) + t2;
  dHS = sqrt(sModular(H - S));
  if (sgn(T2 - (T1 - t1)) >= 0) {
    cout.setf(ios::fixed);
    cout << setprecision(18) << min(T1, T2) << endl;
    return 0;
  }
  long double l = 0, r = min(T1 - dHS, T2), m;
  for (int _ = 0; _ <= 300; ++_) {
    m = (l + r) / 2.0;
    if (check(m))
      l = m;
    else
      r = m;
  }
  cout.setf(ios::fixed);
  cout << setprecision(18) << l << endl;
}
