#include <bits/stdc++.h>
using namespace std;
int dcmp(double p) {
  if (abs(p) < 1e-12) return 0;
  return p > 1e-12 ? 1 : -1;
}
struct Point {
  double first, second;
  Point() {}
  Point(double first, double second) : first(first), second(second) {}
  friend Point operator-(const Point &a, const Point &b) {
    return Point(a.first - b.first, a.second - b.second);
  }
  friend Point operator+(const Point &a, const Point &b) {
    return Point(a.first + b.first, a.second + b.second);
  }
  friend Point operator*(const Point &a, double p) {
    return Point(a.first * p, a.second * p);
  }
  friend Point operator/(const Point &a, double p) {
    return Point(a.first / p, a.second / p);
  }
} a, b, c;
double hl(double a, double b, double c) {
  double P = (a + b + c) / 2;
  return sqrt(P * (P - a) * (P - b) * (P - c));
}
double dot(const Point &a, const Point &b) {
  return a.first * b.first + a.second * b.second;
}
double jl(const Point &a) { return sqrt(dot(a, a)); }
struct Circle {
  Point first;
  double second;
  Circle() {}
  Circle(const Point &first, const double &second)
      : first(first), second(second) {}
  friend bool operator<(const Circle &a, const Circle &b) {
    return dcmp(a.second - b.second) < 0 &&
           dcmp(b.second - a.second - jl(b.first - a.first)) > 0;
  }
  bool cir_po(const Point &a) { return dcmp(jl(a - first) - second) <= 0; }
} can[5], cir[5];
double t1, t2;
pair<Point, Point> get(const Circle &a, const Circle &b) {
  Point flag = Point(1 << 30, 0);
  Point v = b.first - a.first;
  double dis = jl(v);
  v = v / jl(v);
  if (dcmp(dis - a.second - b.second) > 0) return make_pair(flag, flag);
  if (dcmp(dis - a.second - b.second) == 0)
    return make_pair(a.first + v * a.second, a.first + v * a.second);
  double area = hl(dis, a.second, b.second);
  double h = area * 2 / dis;
  double dis1 = sqrt(a.second * a.second - h * h);
  Point p = a.first + v * dis1;
  Point v1 = Point(-v.second, v.first), v2 = Point(v.second, -v.first);
  return make_pair(p + v1 * h, p + v2 * h);
}
bool check(double p) {
  int tot = 0;
  can[1] = Circle(a, p), can[2] = Circle(b, jl(a - b) + t1 - p),
  can[3] = Circle(c, jl(a - c) + t2 - p);
  if (dcmp(can[1].second) < 0 || dcmp(can[2].second) < 0 ||
      dcmp(can[3].second) < 0)
    return false;
  for (int i = 1; i <= 2; i++)
    for (int j = i + 1; j <= 3; j++)
      if (!(can[i] < can[j]) && !(can[j] < can[i])) {
        pair<Point, Point> ans = get(can[i], can[j]);
        if (!dcmp(ans.first.first - (1 << 30))) return false;
      }
  for (int i = 1, j; i <= 3; i++) {
    for (j = 1; j <= 3; j++)
      if (can[j] < can[i]) break;
    if (j > 3) cir[++tot] = can[i];
  }
  if (tot != 3) return true;
  for (int i = 1; i <= 2; i++)
    for (int j = i + 1; j <= 3; j++) {
      int k = 6 - i - j;
      pair<Point, Point> ans = get(cir[i], cir[j]);
      if (cir[k].cir_po(ans.first) || cir[k].cir_po(ans.second)) return true;
    }
  return false;
}
int main() {
  scanf("%lf%lf%lf%lf%lf%lf%lf%lf", &t2, &t1, &a.first, &a.second, &b.first,
        &b.second, &c.first, &c.second);
  if (dcmp(jl(c - a) + jl(c - b) - t1 - jl(b - a)) <= 0) {
    printf("%.10lf", min(jl(b - a) + t1, jl(c - a) + jl(c - b) + t2));
    return 0;
  }
  double l = 0, r = min(jl(b - a) + t1, jl(c - a) + jl(c - b) + t2);
  while (r - l > 1e-12) {
    double mid = (l + r) / 2;
    if (check(mid))
      l = mid;
    else
      r = mid;
  }
  printf("%.10lf", l);
  return 0;
}
