#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int ret = 0, f = 1;
  char c = getchar();
  while (c < 48 || c > 57) {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= 48 && c <= 57) ret = ret * 10 + c - 48, c = getchar();
  return ret * f;
}
long long u;
double lx, ly, rx, ry, L_T, o, h, op, T, t1, t2, uu, vv, g, a[5], b[5], n_x,
    n_y, nx, ny;
inline double di(int u, int v) {
  return sqrt((a[u] - a[v]) * (a[u] - a[v]) + (b[u] - b[v]) * (b[u] - b[v]));
}
inline double get_fc(double x, double y) {
  uu = sqrt((a[2] - x) * (a[2] - x) + (b[2] - y) * (b[2] - y));
  vv = sqrt((a[3] - x) * (a[3] - x) + (b[3] - y) * (b[3] - y));
  g = min(t1 - vv - di(3, 2), t2 - uu) -
      sqrt((a[1] - x) * (a[1] - x) + (b[1] - y) * (b[1] - y));
  if (g < -1e-8) return -1;
  g = sqrt((a[1] - x) * (a[1] - x) + (b[1] - y) * (b[1] - y)) + g;
  return g;
}
inline bool solve() {
  u = T * 2e8;
  h = ((long long)rand() * rand() % 2099999999 * rand() % 99999999999999 +
       rand()) %
          u -
      T * 1e8;
  op = (double)h / 1e8;
  o = sqrt(T * T - op * op);
  ny = n_y + op;
  if (rand() & 1)
    nx = n_x - o;
  else
    nx = n_x + o;
  if (get_fc(n_x, n_y) < get_fc(nx, ny)) {
    n_x = nx, n_y = ny;
    return 1;
  }
  return 0;
}
inline bool dk() {
  if (a[1] == a[2] && a[2] == a[3]) return 1;
  if (a[1] == a[2]) return 0;
  if (a[2] == a[3]) return 0;
  if (fabs((double)(b[1] - b[2]) / (a[1] - a[2]) -
           (double)(b[1] - b[3]) / (a[1] - a[3])) < 1e-8)
    return 1;
  return 0;
}
namespace wqy {
inline double ch(double x, double y) {
  double t = di(2, 3) +
             sqrt((a[1] - x) * (a[1] - x) + (b[1] - y) * (b[1] - y)) +
             sqrt((a[3] - x) * (a[3] - x) + (b[3] - y) * (b[3] - y));
  if (t <= t1 + 1e-8) return 1;
  return 0;
}
int main() {
  if (dk()) {
    if (fabs(di(1, 2) + di(1, 3) - di(2, 3)) < 1e-8) {
      printf("%.9lf\n", min(t2, (t1 - di(1, 3) - di(3, 2)) / 2));
      return 0;
    }
    printf("%.9lf\n", t2);
    return 0;
  }
  lx = a[1];
  ly = b[1];
  rx = a[2];
  ry = b[2];
  for (int i = 1; i <= 200; ++i) {
    double mx = (lx + rx) / 2;
    double my = (ly + ry) / 2;
    if (ch(mx, my)) {
      lx = mx;
      ly = my;
    } else {
      rx = mx;
      ry = my;
    }
  }
  uu = sqrt((a[1] - lx) * (a[1] - lx) + (b[1] - ly) * (b[1] - ly));
  printf("%.9lf\n", uu);
  return 0;
}
}  // namespace wqy
namespace cyb {
inline double ch(double x, double y) {
  double t = sqrt((a[1] - x) * (a[1] - x) + (b[1] - y) * (b[1] - y)) +
             sqrt((a[2] - x) * (a[2] - x) + (b[2] - y) * (b[2] - y));
  if (t <= t2 + 1e-8) return 1;
  return 0;
}
int main() {
  lx = a[1];
  ly = b[1];
  rx = a[3];
  ry = b[3];
  for (int i = 1; i <= 200; ++i) {
    double mx = (lx + rx) / 2;
    double my = (ly + ry) / 2;
    if (ch(mx, my))
      lx = mx, ly = my;
    else
      rx = mx, ry = my;
  }
  uu = sqrt((a[1] - lx) * (a[1] - lx) + (b[1] - ly) * (b[1] - ly));
  printf("%.9lf\n", uu);
  return 0;
}
}  // namespace cyb
int main() {
  t1 = read();
  t2 = read();
  a[1] = read();
  b[1] = read();
  a[2] = read();
  b[2] = read();
  a[3] = read();
  b[3] = read();
  t1 += di(1, 3) + di(3, 2);
  t2 += di(1, 2);
  if (di(1, 3) + di(3, 2) - 1e-8 <= t2) {
    printf("%.9lf\n", min(t1, t2));
    exit(0);
  }
  if (t1 - di(1, 3) - di(3, 2) < 1e-8) {
    if (t2 - di(1, 2) < 1e-8) {
      if (!dk()) {
        puts("0");
        return 0;
      }
      if (fabs(di(1, 2) + di(1, 3) - di(2, 3)) < 1e-8) {
        printf("%.9lf\n", 0);
        return 0;
      }
      printf("%.9lf\n", t2);
      return 0;
    }
    return cyb::main();
  }
  if (t2 - di(1, 2) < 1e-8) return wqy::main();
  n_x = a[1];
  n_y = b[1];
  L_T = di(1, 3);
  T = L_T;
  while (T > 1e-8) {
    for (int i = 1; i <= 1000; ++i)
      if (solve()) continue;
    T *= 0.9;
  }
  printf("%.9lf\n", get_fc(n_x, n_y));
}
