#include <bits/stdc++.h>
using namespace std;
const long double pi = acos(-1.0), eps = 1e-10;
long double det(long double a11, long double a12, long double a21,
                long double a22) {
  return a11 * a22 - a12 * a21;
}
struct pt {
  long double x, y;
  pt(long double x, long double y) : x(x), y(y) {}
};
struct line {
  long double a, b, c;
  line(long double x1, long double y1, long double x2, long double y2) {
    a = y1 - y2;
    b = x2 - x1;
    c = a * x1 + b * y1;
  }
  line(long double a, long double b, long double c) : a(a), b(b), c(c) {}
  void transpose(pt p) { c += a * p.x + b * p.y; }
};
struct circle {
  long double x, y, r;
  circle(long double x, long double y, long double r) : x(x), y(y), r(r) {}
};
long double dist(long double x1, long double y1, long double x2,
                 long double y2) {
  long double dx = x1 - x2, dy = y1 - y2;
  return sqrt(dx * dx + dy * dy);
}
vector<pt> lineCircleIntersection(line l, pt center, long double r) {
  line t(l);
  t.transpose(pt(-center.x, -center.y));
  long double a = t.a, b = t.b, c = -t.c;
  long double x0 = -a * c / (a * a + b * b), y0 = -b * c / (a * a + b * b);
  vector<pt> res;
  if (c * c > r * r * (a * a + b * b) + eps) {
  } else if (fabs(c * c - r * r * (a * a + b * b)) < eps) {
    res.push_back(pt(x0 + center.x, y0 + center.y));
  } else {
    long double d = r * r - c * c / (a * a + b * b);
    long double mult = sqrt(d / (a * a + b * b));
    long double ax, ay, bx, by;
    ax = x0 + b * mult;
    bx = x0 - b * mult;
    ay = y0 - a * mult;
    by = y0 + a * mult;
    res.push_back(pt(ax + center.x, ay + center.y));
    res.push_back(pt(bx + center.x, by + center.y));
  }
  return res;
}
vector<pt> circleCircleIntersection(circle c1, circle c2) {
  long double x = c1.x - c2.x, y = c1.y - c2.y;
  vector<pt> res = lineCircleIntersection(
      line(2 * x, 2 * y, x * x + y * y + c2.r * c2.r - c1.r * c1.r), pt(0, 0),
      c2.r);
  for (int i = 0; i < (int)res.size(); i++) {
    res[i].x += c2.x;
    res[i].y += c2.y;
  }
  return res;
}
bool inside(pt p, circle c) { return dist(p.x, p.y, c.x, c.y) <= c.r + eps; }
bool intersects(circle c1, circle c2, circle c3) {
  c1.r += eps;
  c2.r += eps;
  c3.r += eps;
  vector<pt> p[3];
  p[0] = circleCircleIntersection(c1, c2);
  p[1] = circleCircleIntersection(c2, c3);
  p[2] = circleCircleIntersection(c3, c1);
  p[0].push_back(pt(c1.x, c1.y));
  p[1].push_back(pt(c2.x, c2.y));
  p[2].push_back(pt(c3.x, c3.y));
  for (int i = 0; i < 3; i++) {
    for (size_t j = 0; j < p[i].size(); j++) {
      if (inside(p[i][j], c1) && inside(p[i][j], c2) && inside(p[i][j], c3)) {
        return true;
      }
    }
  }
  return false;
}
long double t1, t2, cx, cy, hx, hy, sx, sy;
void solve() {
  long double d1 = dist(hx, hy, sx, sy), d2 = dist(sx, sy, cx, cy),
              d3 = dist(cx, cy, hx, hy);
  long double l1 = d1 + d2 + t1, l2 = d3 + t2;
  cout << fixed << setprecision(10);
  if (l2 >= d1 + d2) {
    cout << min(l1, l2) << endl;
  } else {
    long double L = 0, R = min(l1, l2);
    while (fabs(L - R) > eps) {
      long double r1 = (L + R) / 2, r2 = max(0. * l1, l1 - d1 - r1),
                  r3 = max(0. * l2, l2 - r1);
      if (intersects(circle(cx, cy, r1), circle(sx, sy, r2),
                     circle(hx, hy, r3))) {
        L = r1;
      } else {
        R = r1;
      }
    }
    cout << L + eps << endl;
  }
}
int main() {
  while (cin >> t1 >> t2 >> cx >> cy >> hx >> hy >> sx >> sy) {
    solve();
  }
}
