#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-7;
double t1, t2;
struct POINT {
  double x, y;
} home, shop, start;
inline double dis(POINT a, POINT b) {
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
double ans = 0;
void work1() {
  double ori_dis1 = dis(start, home);
  double now_dis1 = dis(start, shop) + dis(shop, home);
  if (now_dis1 - ori_dis1 <= t1 + EPS) ans = min(ori_dis1 + t1, now_dis1 + t2);
}
inline void Update(double x, double y, double &Dis) {
  POINT tmp;
  tmp.x = x;
  tmp.y = y;
  if (dis(tmp, start) < Dis) Dis = dis(tmp, start);
}
inline bool In(POINT a, POINT o, double r) { return dis(a, o) <= r; }
bool chk(double mid) {
  double r1 = dis(start, home) + t1 - mid;
  double r2 = dis(start, shop) + t2 - mid;
  if (r1 + r2 < dis(home, shop)) return false;
  double a = 2 * (shop.x - home.x);
  double b = 2 * (shop.y - home.y);
  double c = r1 * r1 - r2 * r2 + shop.x * shop.x + shop.y * shop.y -
             home.x * home.x - home.y * home.y;
  double d = c / a - home.x;
  double A = b * b / a / a + 1, B = -(2 * home.y + 2 * b * d / a),
         C = d * d + home.y * home.y - r1 * r1;
  double Det = sqrt(fabs(B * B - 4 * A * C));
  double Dis = 1000000;
  double xx, yy;
  yy = (-B + Det) / 2 / A;
  xx = (c - b * yy) / a;
  Update(xx, yy, Dis);
  yy = (-B - Det) / 2 / A;
  xx = (c - b * yy) / a;
  Update(xx, yy, Dis);
  if (Dis <= mid) return true;
  POINT tmp;
  double d1 = dis(start, home);
  tmp.x = home.x + r1 / d1 * (start.x - home.x);
  tmp.y = home.y + r1 / d1 * (start.y - home.y);
  if (In(tmp, shop, r2)) Update(tmp.x, tmp.y, Dis);
  d1 = dis(start, shop);
  tmp.x = shop.x + r2 / d1 * (start.x - shop.x);
  tmp.y = shop.y + r2 / d1 * (start.y - shop.y);
  if (In(tmp, home, r1)) Update(tmp.x, tmp.y, Dis);
  if (Dis <= mid) return true;
  return false;
}
void work2() {
  double l = 0, r = dis(start, home) + t1;
  while (r - l > EPS) {
    double mid = (l + r) / 2;
    if (chk(mid))
      l = mid;
    else
      r = mid;
  }
  ans = (l + r) / 2;
}
int main() {
  cin >> t2 >> t1;
  cin >> start.x >> start.y;
  cin >> home.x >> home.y;
  cin >> shop.x >> shop.y;
  work1();
  if (ans != 0) {
    cout << setiosflags(ios::fixed) << setprecision(8) << ans << endl;
  } else {
    if (home.x == shop.x) {
      swap(start.x, start.y);
      swap(shop.x, shop.y);
      swap(home.x, home.y);
    }
    work2();
    cout << setiosflags(ios::fixed) << setprecision(8) << ans << endl;
  }
  return 0;
}
