#include <bits/stdc++.h>
using namespace std;
double eps = 1e-10;
struct dot {
  double x, y;
  dot(double xx = 0, double yy = 0) { x = xx, y = yy; }
};
dot shop, cinema, house;
double t1, t2;
dot operator-(dot a, dot b) { return (dot(a.x - b.x, a.y - b.y)); }
double dist(dot a) {
  return sqrt((double)a.x * (double)a.x + (double)a.y * (double)a.y + eps);
}
double ans = 0;
int in_or_on_circle(dot a, double ra, dot b) {
  if (dist(b - a) <= ra + eps) return 1;
  return 0;
}
int flag;
pair<dot, dot> line_with_circle(double kk, double bb, dot b, double rb) {
  flag = 0;
  ;
  double x1 = b.x, y1 = b.y;
  double A = (1 + kk * kk), B = -2 * x1 + 2 * kk * bb - 2 * y1 * kk,
         C = x1 * x1 + bb * bb - 2 * y1 * bb + y1 * y1 - rb * rb;
  double delta = (B * B - 4 * A * C) + eps;
  if (delta < 0) return make_pair((dot)(0, 0), (dot)(0, 0));
  flag = 1;
  dot gg1, gg2;
  double gx = (-B + sqrt(delta)) / 2 / A;
  gg1 = dot(gx, gx * kk + bb);
  gx = (-B - sqrt(delta)) / 2 / A;
  gg2 = dot(gx, gx * kk + bb);
  return make_pair(gg1, gg2);
}
pair<dot, dot> circle_with_circle(dot a, double ra, dot b, double rb) {
  flag = 0;
  double cd, cf;
  int swa = 0;
  if (fabs(a.y - b.y) <= eps) swap(a.x, a.y), swap(b.x, b.y), swa = 1;
  ;
  cd = (2 * b.x - 2 * a.x) / (2 * a.y - 2 * b.y),
  cf = (a.x * a.x - b.x * b.x + a.y * a.y - b.y * b.y - ra * ra + rb * rb) /
       (2 * a.y - 2 * b.y);
  pair<dot, dot> po = line_with_circle(cd, cf, b, rb);
  if (swa) swap(po.first.x, po.first.y), swap(po.second.x, po.second.y);
  return po;
}
int overlap(dot a, double ra, dot b, double rb, dot c, double rc) {
  pair<dot, dot> u;
  u = circle_with_circle(a, ra, b, rb);
  if (flag and in_or_on_circle(c, rc, u.first)) return 1;
  if (flag and in_or_on_circle(c, rc, u.second)) return 1;
  u = circle_with_circle(a, ra, c, rc);
  if (flag and in_or_on_circle(b, rb, u.first)) return 1;
  if (flag and in_or_on_circle(b, rb, u.second)) return 1;
  u = circle_with_circle(b, rb, c, rc);
  if (flag and in_or_on_circle(a, ra, u.first)) return 1;
  if (flag and in_or_on_circle(a, ra, u.second)) return 1;
  if (in_or_on_circle(a, ra, b) and in_or_on_circle(c, rc, b)) return 1;
  if (in_or_on_circle(a, ra, c) and in_or_on_circle(b, rb, c)) return 1;
  if (in_or_on_circle(b, rb, a) and in_or_on_circle(c, rc, a)) return 1;
  return 0;
}
double calc(double mid) {
  double d1 = t1 - mid, d2 = t2 - mid;
  if (d1 < 0 or d2 < 0) return 0;
  if (overlap(cinema, mid, shop, d1, house, d2)) return 1;
  return 0;
}
int main() {
  cin >> t1 >> t2 >> cinema.x >> cinema.y >> house.x >> house.y >> shop.x >>
      shop.y;
  t1 = t1 + dist(cinema - shop);
  t2 = t2 + dist(cinema - house);
  if (t2 >= dist(cinema - shop) + dist(shop - house) - eps) {
    printf("%.8lf", min(t1 + dist(shop - house), t2));
    return 0;
  }
  double l = 0, r = 1002;
  double ans = 0;
  while (r - l > 1e-10) {
    double mid = (l + r) / 2;
    if (calc(mid)) {
      l = mid + 1e-10;
      ans = mid;
    } else {
      r = mid - 1e-10;
    }
  }
  printf("%.8lf", ans);
}
