#include <bits/stdc++.h>
using namespace std;
double t1, t2, cimx, cimy, fx, fy, sx, sy;
double limit1, limit2, x1, y11, x2, y22;
int dcmp(double x) {
  if (fabs(x) < 1e-10) return 0;
  if (x > 1e-10)
    return 1;
  else
    return -1;
}
double dis(double xx, double xy, double yx, double yy) {
  return sqrt((xx - yx) * (xx - yx) + (xy - yy) * (xy - yy));
}
bool pan(double xx, double xy, double rx, double yx, double yy, double ry) {
  return dcmp(dis(xx, xy, yx, yy) - rx - ry) <= 0;
}
bool in(double xx, double xy, double yx, double yy, double ry) {
  return dcmp(ry - dis(xx, xy, yx, yy)) >= 0;
}
bool ok(double xx, double xy, double rx, double yx, double yy, double ry) {
  return dcmp(fabs(ry - rx) - dis(xx, xy, yx, yy)) >= 0;
}
double SS(double x, double y, double z) {
  double p = (x + y + z) / 2.0;
  return sqrt(p * (p - x) * (p - y) * (p - z));
}
void getpoint(double xx, double xy, double rx, double yx, double yy,
              double ry) {
  if (dcmp(dis(xx, xy, yx, yy) - rx - ry) == 0) {
    double nowx, nowy;
    nowx = yx - xx;
    nowy = yy - xy;
    nowx /= dis(xx, xy, yx, yy), nowy /= dis(xx, xy, yx, yy);
    nowx *= rx, nowy *= rx;
    x1 = x2 = xx + nowx;
    y11 = y22 = xy + nowy;
    return;
  }
  double dist = dis(xx, xy, yx, yy);
  double area = SS(rx, ry, dist);
  double h = area * 2.0 / dist;
  double kk = sqrt(rx * rx - h * h);
  double nowx, nowy, t = kk / dist;
  nowx = xx + t * (-xx + yx);
  nowy = xy + t * (-xy + yy);
  double now1x, now1y;
  now1x = xx - nowx;
  now1y = xy - nowy;
  swap(now1x, now1y);
  now1y *= -1;
  double distt = dis(xx, xy, nowx, nowy);
  now1x /= distt, now1y /= distt;
  now1x *= h, now1y *= h;
  x1 = now1x + nowx, y11 = now1y + nowy;
  x2 = nowx - now1x, y22 = nowy - now1y;
  return;
}
bool check(double x) {
  double r1 = limit2 - x, r2 = limit1 - dis(fx, fy, sx, sy) - x;
  if (dcmp(r1) <= 0 || dcmp(r2) <= 0) return false;
  bool u1;
  u1 = ok(fx, fy, r1, cimx, cimy, x);
  if (u1 == true && pan(fx, fy, r1, sx, sy, r2) == true) return true;
  u1 = ok(sx, sy, r2, cimx, cimy, x);
  if (u1 == true && pan(sx, sy, r2, fx, fy, r1) == true) return true;
  u1 = ok(fx, fy, r1, sx, sy, r2);
  if (u1 == true && pan(fx, fy, r1, cimx, cimy, x) == true) return true;
  getpoint(fx, fy, r1, cimx, cimy, x);
  if (in(x1, y11, sx, sy, r2) == true || in(x2, y22, sx, sy, r2) == true)
    return true;
  getpoint(sx, sy, r2, cimx, cimy, x);
  if (in(x1, y11, fx, fy, r1) == true || in(x2, y22, fx, fy, r1) == true)
    return true;
  getpoint(fx, fy, r1, sx, sy, r2);
  if (in(x1, y11, cimx, cimy, x) == true || in(x2, y22, cimx, cimy, x) == true)
    return true;
  return false;
}
double find(double x, double y) {
  double l = x, r = y, mid = (x + y) / 2.0;
  while (dcmp(r - l) == 1) {
    mid = (l + r) / 2.0;
    bool u = check(mid);
    if (u == true)
      l = mid;
    else
      r = mid;
  }
  return mid;
}
void work() {
  limit1 = dis(cimx, cimy, sx, sy) + dis(sx, sy, fx, fy) + t1;
  limit2 = dis(cimx, cimy, fx, fy) + t2;
  if (dcmp(dis(cimx, cimy, sx, sy) + dis(sx, sy, fx, fy) - limit2) <= 0) {
    printf("%.10lf\n", min(limit1, limit2));
    return;
  }
  printf("%.10lf\n", find(0, 200));
}
int main() {
  scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &t1, &t2, &cimx, &cimy, &fx, &fy, &sx, &sy);
  work();
  return 0;
}
