#include <bits/stdc++.h>
using namespace std;
const long double eps = 1e-10;
struct Tpoint {
  long double x, y;
  void input() {
    double _x, _y;
    scanf("%lf%lf", &_x, &_y);
    x = _x;
    y = _y;
  }
} C, H, S;
double t1, t2;
long double T1, T2;
long double ret;
long double Fabs(long double x) { return x < 0 ? -x : x; }
long double Fmin(long double x, long double y) { return x < y ? x : y; }
long double Fmax(long double x, long double y) { return x > y ? x : y; }
long double dist2(Tpoint a, Tpoint b) {
  return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
}
long double dist(Tpoint a, Tpoint b) { return sqrt(Fabs(dist2(a, b))); }
void init() {
  scanf("%lf%lf", &t1, &t2);
  C.input();
  H.input();
  S.input();
}
bool Inside(Tpoint A, long double r, Tpoint p) {
  return dist2(A, p) < r * r + eps;
}
bool inter(Tpoint A, Tpoint B, long double ra, long double rb) {
  return dist(A, B) < ra + rb + eps;
}
void Normalize(long double &x) {
  if (x > 1.0) x = 1.0;
  if (x < -1.0) x = -1.0;
}
bool inter(Tpoint A, Tpoint B, Tpoint C, long double ra, long double rb,
           long double rc) {
  if (dist(A, B) < Fabs(ra - rb) + eps) return 1;
  long double alpha = atan2(B.y - A.y, B.x - A.x);
  long double dis2 = dist2(A, B);
  long double cosine =
      (ra * ra + dis2 - rb * rb) / (2.0 * ra * sqrt(Fabs(dis2)));
  Normalize(cosine);
  long double beta = acos(cosine);
  Tpoint p;
  p.x = A.x + ra * cos(alpha + beta);
  p.y = A.y + ra * sin(alpha + beta);
  if (Inside(C, rc, p)) return 1;
  p.x = A.x + ra * cos(alpha - beta);
  p.y = A.y + ra * sin(alpha - beta);
  if (Inside(C, rc, p)) return 1;
  return 0;
}
bool check(long double cur) {
  long double rc = cur, rh = Fmax(0, T2 - cur),
              rs = Fmax(0, T1 - cur - dist(S, H));
  if (!inter(C, H, rc, rh) || !inter(C, S, rc, rs) || !inter(H, S, rh, rs))
    return 0;
  if (inter(C, H, S, rc, rh, rs)) return 1;
  if (inter(C, S, H, rc, rs, rh)) return 1;
  if (inter(H, S, C, rh, rs, rc)) return 1;
  return 0;
}
long double solve() {
  T1 = dist(C, S) + dist(S, H) + t1;
  T2 = dist(C, H) + t2;
  if (T1 - t1 < T2 + eps) return Fmin(T1, T2);
  long double L = 0, r = Fmin(T1, T2);
  for (int it = 0; it < 100; it++) {
    long double mid = (L + r) / 2;
    if (check(mid))
      L = mid;
    else
      r = mid;
  }
  return L;
}
void print() { printf("%.10lf\n", (double)solve()); }
int main() {
  init();
  print();
  return 0;
}
