#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void chkmin(T &a, T b) {
  if (a > b) a = b;
}
template <class T>
inline void chkmax(T &a, T b) {
  if (a < b) a = b;
}
struct point {
  double x, y;
};
double dist(point P, point Q) {
  double dx = P.x - Q.x, dy = P.y - Q.y;
  return sqrt(dx * dx + dy * dy);
}
vector<point> cccross(point O1, double r1, point O2, double r2) {
  double d = dist(O1, O2);
  double t = (d * d + r1 * r1 - r2 * r2) / 2.0 / d / d;
  double fx = O1.x + (O2.x - O1.x) * t, fy = O1.y + (O2.y - O1.y) * t;
  double h = sqrt(max(r1 * r1 - t * d * t * d, 0.0));
  double dx = (O2.y - O1.y) / d * h, dy = (O1.x - O2.x) / d * h;
  vector<point> ans;
  point ans1 = {fx + dx, fy + dy};
  ans.push_back(ans1);
  point ans2 = {fx - dx, fy - dy};
  ans.push_back(ans2);
  return ans;
}
point read(void) {
  double x, y;
  scanf("%lf%lf", &x, &y);
  point P = {x, y};
  return P;
}
bool tri(double a, double b, double c) {
  double d[] = {a, b, c};
  sort(d, d + 3);
  return (d[0] + d[1] + 1.0E-12 > d[2]);
}
bool possible(point P, double p, point Q, double q, point R, double r) {
  if (dist(P, Q) < q + 1.0E-12 && dist(P, R) < r + 1.0E-12) return true;
  if (dist(Q, R) < r + 1.0E-12 && dist(Q, P) < p + 1.0E-12) return true;
  if (dist(R, P) < p + 1.0E-12 && dist(R, Q) < q + 1.0E-12) return true;
  if (tri(dist(P, Q), p, q)) {
    vector<point> vp = cccross(P, p, Q, q);
    if (dist(vp[0], R) < r + 1.0E-12) return true;
    if (dist(vp[1], R) < r + 1.0E-12) return true;
  }
  if (tri(dist(Q, R), q, r)) {
    vector<point> vp = cccross(Q, q, R, r);
    if (dist(vp[0], P) < p + 1.0E-12) return true;
    if (dist(vp[1], P) < p + 1.0E-12) return true;
  }
  if (tri(dist(R, P), r, p)) {
    vector<point> vp = cccross(R, r, P, p);
    if (dist(vp[0], Q) < q + 1.0E-12) return true;
    if (dist(vp[1], Q) < q + 1.0E-12) return true;
  }
  return false;
}
int main() {
  double t1, t2;
  scanf("%lf%lf", &t1, &t2);
  point P = read(), Q = read(), R = read();
  if (dist(P, R) + dist(R, Q) < dist(P, Q) + t2 + 1.0E-12) {
    double ans = min(dist(P, R) + dist(R, Q) + t1, dist(P, Q) + t2);
    printf("%.9f\n", ans);
    return 0;
  }
  double low = 0.0, high = min(dist(P, R) + t1, dist(P, Q) + t2), mid;
  int i;
  for (i = 0; i < 100; i++) {
    mid = (high + low) / 2.0;
    if (possible(P, mid, Q, dist(P, Q) + t2 - mid, R, dist(P, R) + t1 - mid))
      low = mid;
    else
      high = mid;
  }
  printf("%.9f\n", mid);
  return 0;
}
