#include <bits/stdc++.h>
using namespace std;
struct Point {
  double x, y;
};
Point readPoint() {
  double x, y;
  cin >> x >> y;
  Point p = {x, y};
  return p;
}
double dist(Point &a, Point &b) {
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
vector<Point> ccCross(Point &p1, double r1, Point &p2, double r2) {
  double d = dist(p1, p2);
  double t = ((d * d + r1 * r1 - r2 * r2) / (2.0 * d)) / d;
  double fx = p1.x + t * (p2.x - p1.x), fy = p1.y + t * (p2.y - p1.y);
  double h = sqrt(max(r1 * r1 - t * d * t * d, 0.0));
  double dx = (p2.y - p1.y) * (h / d), dy = (p1.x - p2.x) * (h / d);
  vector<Point> ret;
  Point t1 = {fx + dx, fy + dy};
  Point t2 = {fx - dx, fy - dy};
  ret.push_back(t1);
  ret.push_back(t2);
  return ret;
}
bool tri(double a, double b, double c) {
  double d[] = {a, b, c};
  sort(d, d + 3);
  return (d[0] + d[1] + 1e-12 > d[2]);
}
bool possible(Point &p1, double r1, Point &p2, double r2, Point &p3,
              double r3) {
  if (dist(p1, p2) < r2 + 1e-12 && dist(p1, p3) < r3 + 1e-12) return true;
  if (dist(p2, p1) < r1 + 1e-12 && dist(p2, p3) < r3 + 1e-12) return true;
  if (dist(p3, p1) < r1 + 1e-12 && dist(p3, p2) < r2 + 1e-12) return true;
  if (tri(dist(p1, p2), r1, r2)) {
    vector<Point> ip = ccCross(p1, r1, p2, r2);
    if (dist(ip[0], p3) < r3 + 1e-12) return true;
    if (dist(ip[1], p3) < r3 + 1e-12) return true;
  }
  if (tri(dist(p1, p3), r1, r3)) {
    vector<Point> ip = ccCross(p1, r1, p3, r3);
    if (dist(ip[0], p2) < r2 + 1e-12) return true;
    if (dist(ip[1], p2) < r2 + 1e-12) return true;
  }
  if (tri(dist(p2, p3), r2, r3)) {
    vector<Point> ip = ccCross(p2, r2, p3, r3);
    if (dist(ip[0], p1) < r1 + 1e-12) return true;
    if (dist(ip[1], p1) < r1 + 1e-12) return true;
  }
  return false;
}
int main() {
  double t1, t2;
  cin >> t1 >> t2;
  Point A = readPoint(), B = readPoint(), C = readPoint();
  if (dist(A, C) + dist(C, B) < dist(A, B) + t2 + 1e-12) {
    cout << fixed << setprecision(9)
         << min(dist(A, C) + dist(C, B) + t1, dist(A, B) + t2) << endl;
    return 0;
  }
  double low = 0, mid = 0, high = min(dist(A, C) + t1, dist(A, B) + t2);
  for (int i = 0; i < 100; ++i) {
    mid = (low + high) / 2.0;
    if (possible(A, mid, B, dist(A, B) + t2 - mid, C, dist(A, C) + t1 - mid))
      low = mid;
    else
      high = mid;
  }
  cout << fixed << setprecision(9) << mid << endl;
  return 0;
}
