#include <bits/stdc++.h>
using namespace std;
double t1, t2;
double cx, cy, hx, hy, sx, sy;
long double dis(long double x1, long double y1, long double x2,
                long double y2) {
  return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
double min(long double A, long double B) {
  if (A < B)
    return A;
  else
    return B;
}
double max(long double A, long double B) {
  if (A > B)
    return A;
  else
    return B;
}
bool Ck1(long double x1, long double y1, long double r1, long double x2,
         long double y2, long double r2, long double x3, long double y3,
         long double r3) {
  long double l = dis(x1, y1, x2, y2);
  long double x = (r1 * r1 - r2 * r2 + l * l) / 2 / l;
  long double dx = x2 - x1, dy = y2 - y1;
  dx /= l, dy /= l;
  long double tx = dx * x + x1, ty = dy * x + y1;
  swap(dx, dy);
  long double t = (r1 * r1 - x * x) + 1E-9;
  long double h = sqrt(t);
  if (dis(tx - dx * h, ty + dy * h, x3, y3) < r3 - 1E-8 ||
      dis(tx + dx * h, ty - dy * h, x3, y3) <= r3 - 1E-8)
    return true;
  return false;
}
bool chk(long double x1, long double y1, long double r1, long double x2,
         long double y2, long double r2, long double x3, long double y3,
         long double r3) {
  long double d12 = dis(x1, y1, x2, y2);
  if (r1 + r2 <= d12 - 1E-7 || r1 + r3 <= dis(x1, y1, x3, y3) - 1E-7 ||
      r2 + r3 <= dis(x2, y2, x3, y3) - 1E-7)
    return false;
  if (dis(x1, y1, x2, y2) + min(r1, r2) <= max(r2, r1)) return true;
  if (dis(x1, y1, x3, y3) + min(r1, r3) <= max(r3, r1)) return true;
  if (dis(x3, y3, x2, y2) + min(r3, r2) <= max(r2, r3)) return true;
  if (Ck1(x1, y1, r1, x2, y2, r2, x3, y3, r3)) return true;
  if (Ck1(x1, y1, r1, x3, y3, r3, x2, y2, r2)) return true;
  if (Ck1(x3, y3, r3, x2, y2, r2, x1, y1, r1)) return true;
  return false;
}
int main() {
  scanf("%lf%lf", &t1, &t2);
  scanf("%lf%lf", &cx, &cy);
  scanf("%lf%lf", &hx, &hy);
  scanf("%lf%lf", &sx, &sy);
  t1 += dis(cx, cy, sx, sy);
  t2 += dis(cx, cy, hx, hy);
  if (dis(cx, cy, sx, sy) + dis(sx, sy, hx, hy) <= t2) {
    printf("%.8lf\n", min(t2, t1 + dis(sx, sy, hx, hy)));
    return 0;
  }
  long double l = 0, r = min(t1, t2);
  if (t1 > t2) {
    swap(hx, sx);
    swap(hy, sy);
    swap(t1, t2);
  }
  while (l + 1E-7 < r) {
    long double mid = (l + r) / 2;
    if (chk(sx, sy, t1 - mid, hx, hy, t2 - mid, cx, cy, mid))
      l = mid;
    else
      r = mid;
  }
  printf("%.8lf\n", double(r));
  return 0;
}
