#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-10;
struct Point {
  long double x, y;
};
Point operator+(Point a, Point b) {
  a.x += b.x;
  a.y += b.y;
  return a;
}
Point operator-(Point a, Point b) {
  a.x -= b.x;
  a.y -= b.y;
  return a;
}
long double len(Point p) { return sqrt(p.x * p.x + p.y * p.y); }
Point operator*(long double k, Point a) {
  a.x *= k;
  a.y *= k;
  return a;
}
Point ortho(Point a) {
  Point b;
  b.x = a.y;
  b.y = -a.x;
  return b;
}
vector<Point> getIntersection(Point A, Point B, long double R1,
                              long double R2) {
  vector<Point> ans;
  long double d = len(A - B);
  long double x = (d * d + R1 * R1 - R2 * R2) / (2 * d);
  if (abs(abs(x) - R1) < EPS) x = R1;
  if (R1 < abs(x)) return ans;
  long double y = sqrt(R1 * R1 - x * x);
  Point V = B - A;
  V.x /= d;
  V.y /= d;
  Point m = A + x * V;
  ans.push_back(m + y * ortho(V));
  ans.push_back(m + (-y) * ortho(V));
  return ans;
}
Point A, B, C;
long double RA, RB, RC;
bool inside(Point p) {
  if (len(p - A) > RA + EPS) return false;
  if (len(p - B) > RB + EPS) return false;
  if (len(p - C) > RC + EPS) return false;
  return true;
}
int main() {
  long double t1, t2;
  ignore = scanf("%Lf %Lf", &t1, &t2);
  ignore = scanf("%Lf %Lf", &B.x, &B.y);
  ignore = scanf("%Lf %Lf", &A.x, &A.y);
  ignore = scanf("%Lf %Lf", &C.x, &C.y);
  long double T1 = t1 + len(C - B) + len(C - A);
  long double T2 = t2 + len(B - A);
  if (T2 >= len(B - C) + len(C - A)) {
    printf("%.15Lf", min(T1, T2));
    return 0;
  }
  long double L = 0, R = min(T2, len(B - C) + t1);
  for (int it = 0; it < 1000; it++) {
    double l = (L + R) / 2.0;
    RA = len(A - B) + t2 - l;
    RB = l;
    RC = len(B - C) + t1 - l;
    vector<Point> pts;
    vector<Point> tmp = getIntersection(A, B, RA, RB);
    for (Point p : tmp) pts.push_back(p);
    tmp = getIntersection(A, C, RA, RC);
    for (Point p : tmp) pts.push_back(p);
    tmp = getIntersection(B, C, RB, RC);
    for (Point p : tmp) pts.push_back(p);
    pts.push_back(A);
    pts.push_back(B);
    pts.push_back(C);
    bool ok = false;
    for (Point p : pts) {
      if (inside(p)) {
        ok = true;
        break;
      }
    }
    if (ok)
      L = l;
    else
      R = l;
  }
  printf("%.15Lf", R);
}
