#include <bits/stdc++.h>
using namespace std;
pair<double, double> operator-(const pair<double, double>& lhs,
                               const pair<double, double>& rhs) {
  return pair<double, double>(lhs.first - rhs.first, lhs.second - rhs.second);
}
pair<double, double> operator+(const pair<double, double>& lhs,
                               const pair<double, double>& rhs) {
  return pair<double, double>(lhs.first + rhs.first, lhs.second + rhs.second);
}
pair<double, double> operator*(double t, pair<double, double> p) {
  return pair<double, double>(t * p.first, t * p.second);
}
pair<double, double> operator/(pair<double, double> p, double t) {
  return pair<double, double>(p.first / t, p.second / t);
}
double Cross(const pair<double, double>& lhs, const pair<double, double>& rhs) {
  return lhs.first * rhs.second - lhs.second * rhs.first;
}
double Dot(const pair<double, double>& lhs, const pair<double, double>& rhs) {
  return lhs.first * rhs.first + lhs.second * rhs.second;
}
double Dist2(const pair<double, double>& lhs, const pair<double, double>& rhs) {
  return Dot(lhs - rhs, lhs - rhs);
}
bool onSegment(pair<double, double> a, pair<double, double> b,
               pair<double, double> c) {
  pair<double, double> v = c - a;
  pair<double, double> w = b - a;
  return Cross(v, w) == 0 && 0 <= Dot(v, w) && Dot(v, w) <= Dot(v, v);
}
bool Intersects(pair<double, double> s0, pair<double, double> e0,
                pair<double, double> s1, pair<double, double> e1) {
  pair<double, double> a = s1 - s0;
  pair<double, double> v = e0 - s0;
  pair<double, double> w = s1 - e1;
  double det = Cross(v, w);
  double t0 = w.second * a.first - w.first * a.second;
  double t1 = -v.second * a.first + v.first * a.second;
  if (det < 0) {
    if (det <= t0 && det <= t1 && t0 <= 0 && t1 <= 0) {
      return true;
    }
  } else if (det > 0) {
    if (0 <= t0 && 0 <= t1 && t0 <= det && t1 <= det) {
      return true;
    }
  }
  return onSegment(s0, s1, e0) || onSegment(s0, e1, e0) ||
         onSegment(s1, s0, e1) || onSegment(s1, e0, e1);
}
bool IntersectLineParam(pair<double, double> s0, pair<double, double> e0,
                        pair<double, double> s1, pair<double, double> e1,
                        double& t0, double& t1) {
  pair<double, double> a = s1 - s0;
  pair<double, double> v = e0 - s0;
  pair<double, double> w = s1 - e1;
  double det = Cross(v, w);
  if (det == 0) {
    return false;
  }
  t0 = Cross(a, w) / det;
  t1 = Cross(v, a) / det;
  return true;
}
pair<double, double> Interpolate(pair<double, double> s, pair<double, double> e,
                                 double t) {
  return (1 - t) * s + t * e;
}
bool IntersectLine(pair<double, double> s0, pair<double, double> e0,
                   pair<double, double> s1, pair<double, double> e1,
                   pair<double, double>& result) {
  double t0, t1;
  if (IntersectLineParam(s0, e0, s1, e1, t0, t1)) {
    result = Interpolate(s0, e0, t0);
    return true;
  }
  return false;
}
bool Intersects(vector<pair<double, double> >& lhs,
                vector<pair<double, double> >& rhs) {
  for (int i = 1; i < lhs.size(); i++) {
    for (int j = 1; j < rhs.size(); j++) {
      if (Intersects(lhs[i], lhs[i - 1], rhs[j], rhs[j - 1])) {
        return true;
      }
    }
  }
  return false;
}
bool IsInside(vector<pair<double, double> >& ps, pair<double, double> p) {
  int count = 0;
  for (int i = 0; i < ps.size(); i++) {
    pair<double, double> a = ps[i];
    pair<double, double> b = ps[(i + 1) % ps.size()];
    if (min(a.first, b.first) <= p.first && p.first < max(a.first, b.first)) {
      double c = Cross(p - a, b - a);
      if (c == 0) {
        return true;
      }
      if (c < 0) {
        count--;
      } else {
        count++;
      }
    } else if (a.first == p.first && b.first == p.first) {
      if (min(a.second, b.second) <= p.second &&
          p.second <= max(a.second, b.second)) {
        return true;
      }
    }
  }
  return count != 0;
}
double area(vector<pair<double, double> > ps) {
  double sum = 0;
  for (int i = 0; i < ps.size(); i++) {
    sum += Cross(ps[i], ps[(i + 1) % ps.size()]);
  }
  return abs(sum) / 2;
}
void full(vector<pair<double, double> >& in,
          vector<pair<double, double> >& out) {
  sort(in.begin(), in.end());
  for (int i = 0; i < in.size(); i++) {
    while (out.size() >= 2) {
      pair<double, double> v = out[out.size() - 1] - out[out.size() - 2];
      pair<double, double> w = in[i] - out[out.size() - 1];
      if (Cross(v, w) >= 0) {
        out.pop_back();
      } else {
        break;
      }
    }
    out.push_back(in[i]);
  }
  for (int i = in.size() - 2, k = max((int)out.size(), 1); i >= 0; i--) {
    while (out.size() > k) {
      pair<double, double> v = out[out.size() - 1] - out[out.size() - 2];
      pair<double, double> w = in[i] - out[out.size() - 1];
      if (Cross(v, w) >= 0) {
        out.pop_back();
      } else {
        break;
      }
    }
    out.push_back(in[i]);
  }
}
void IntersectCircleLine(pair<double, double> c, double r,
                         pair<double, double> s, pair<double, double> v,
                         vector<pair<double, double> >& result) {
  pair<double, double> w = c - s;
  double v2 = Dot(v, v);
  pair<double, double> a = Dot(v, w) * v / v2 + s;
  double d2 = Dist2(c, a);
  if (d2 > r * r) {
    return;
  } else if (d2 == r * r) {
    result.push_back(a);
  }
  pair<double, double> e = v / sqrt(v2);
  double len = sqrt(r * r - d2);
  result.push_back(len * e + a);
  result.push_back((-len) * e + a);
}
void IntersectCircleCircle(pair<double, double> c0, double a,
                           pair<double, double> c1, double b,
                           vector<pair<double, double> >& result) {
  double d2 = Dist2(c0, c1);
  if (d2 > (a + b) * (a + b)) {
    return;
  }
  pair<double, double> s = Interpolate(c0, c1, ((a * a - b * b) / d2 + 1) / 2);
  pair<double, double> d = c0 - c1;
  IntersectCircleLine(c0, a, s, pair<double, double>(d.second, -d.first),
                      result);
}
pair<double, double> rot(pair<double, double> a) {
  return pair<double, double>(-a.second, a.first);
}
void RatioConstantCircle(pair<double, double> c0, double a,
                         pair<double, double> c1, double b,
                         pair<double, double>& c, double& r) {
  if (a > b) {
    swap(c0, c1);
    swap(a, b);
  }
  pair<double, double> p = Interpolate(c0, c1, a / (a + b));
  pair<double, double> q = Interpolate(c0, c1, -a / (b - a));
  c = (p + q) / 2;
  r = sqrt(Dist2(c, p));
}
bool Intersect3Circles(pair<double, double> c0, double r0,
                       pair<double, double> c1, double r1,
                       pair<double, double> c2, double r2) {
  vector<pair<double, double> > result;
  for (int i = 0; i < 3; i++) {
    result.clear();
    IntersectCircleCircle(c0, r0, c1, r1, result);
    for (auto p : result) {
      if (Dist2(p, c2) <= r2 * r2) {
        return true;
      }
    }
    if (Dist2(c0, c1) <= r1 * r1 && Dist2(c0, c2) <= r2 * r2) {
      return true;
    }
    swap(c0, c1);
    swap(c1, c2);
    swap(r0, r1);
    swap(r1, r2);
  }
  return false;
}
const double eps = 1e-12;
int main() {
  cout.precision(10);
  double t1, t2, cx, cy, ax, ay, bx, by;
  cin >> t1 >> t2 >> cx >> cy >> ax >> ay >> bx >> by;
  pair<double, double> c(cx, cy), a(ax, ay), b(bx, by);
  double ac = sqrt(Dist2(c, a)), cb = sqrt(Dist2(c, b)), ba = sqrt(Dist2(b, a));
  double low = 0;
  if (ac + t2 >= cb + ba) {
    low = max(low, min(ac + t2, cb + ba + t1));
  }
  if (cb + t1 >= ac + ba) {
    low = max(low, min(cb + t1 - ba, ac + t2));
  }
  t1 += cb;
  t2 += ac;
  double hi = 300;
  for (int i = 0; i < 1000; i++) {
    double m = (low + hi) / 2;
    bool ok = false;
    if (t1 + eps >= m && t2 + eps >= m) {
      ok = Intersect3Circles(a, t2 - m + eps, b, t1 - m + eps, c, m + eps);
    }
    if (ok) {
      low = m;
    } else {
      hi = m;
    }
  }
  cout << (low + hi) / 2 << endl;
  return 0;
}
