Problem: Two neighbours, Alan and Bob, live in the city, where there are three buildings only: a cinema, a shop and the house, where they live. The rest is a big asphalt square. 

Once they went to the cinema, and the film impressed them so deeply, that when they left the cinema, they did not want to stop discussing it.

Bob wants to get home, but Alan has to go to the shop first, and only then go home. So, they agreed to cover some distance together discussing the film (their common path might pass through the shop, or they might walk circles around the cinema together), and then to part each other's company and go each his own way. After they part, they will start thinking about their daily pursuits; and even if they meet again, they won't be able to go on with the discussion. Thus, Bob's path will be a continuous curve, having the cinema and the house as its ends. Alan's path — a continuous curve, going through the shop, and having the cinema and the house as its ends.

The film ended late, that's why the whole distance covered by Alan should not differ from the shortest one by more than t1, and the distance covered by Bob should not differ from the shortest one by more than t2.

Find the maximum distance that Alan and Bob will cover together, discussing the film.

Input

The first line contains two integers: t1, t2 (0 ≤ t1, t2 ≤ 100). The second line contains the cinema's coordinates, the third one — the house's, and the last line — the shop's. 

All the coordinates are given in meters, are integer, and do not exceed 100 in absolute magnitude. No two given places are in the same building.

Output

In the only line output one number — the maximum distance that Alan and Bob will cover together, discussing the film. Output the answer accurate to not less than 4 decimal places.

Examples

Input

0 2
0 0
4 0
-3 0


Output

1.0000000000


Input

0 0
0 0
2 0
1 0


Output

2.0000000000

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
const int fin = 0;
const long double eps = 1e-12;
long double AB, AC, BC;
long double t1, t2;
inline long double Abs(const long double &a) { return a > 0 ? a : -a; }
inline long double Sqrt(const long double &C) {
  long double x = C, t;
  while (t = (x + C / x) * 0.5, Abs(t - x) > 1e-12) x = t;
  return x;
}
struct pt {
  long double x, y;
  pt() {}
  pt(const long double &x, const long double &y) : x(x), y(y) {}
  friend istream &operator>>(istream &I, pt &a) { return I >> a.x >> a.y, I; }
  pt operator+(const pt &a) { return pt(x + a.x, y + a.y); }
} A, B, C;
long double d(const pt &a, const pt &b) {
  return Sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
bool chk(pt P, long double r1, pt Q, long double r2, pt S, long double r3) {
  long double x0 = Q.x - P.x, y0 = Q.y - P.y,
              T = (r1 * r1 - r2 * r2 + x0 * x0 + y0 * y0) * 0.5;
  long double x, y;
  if (Abs(y0) < eps) {
    x = T / x0, y = Sqrt(r1 * r1 - x * x);
    if (d(P + pt(x, y), S) <= r3) return 1;
    y = -y;
    if (d(P + pt(x, y), S) <= r3) return 1;
  }
  long double A = x0 * x0 + y0 * y0, B = -2 * T * x0,
              C = T * T - r1 * r1 * y0 * y0,
              D = max(B * B - 4 * A * C, (long double)0);
  x = (-B - Sqrt(D)) * 0.5 / A, y = (T - x * x0) / y0;
  if (d(P + pt(x, y), S) <= r3) return 1;
  x = (-B + Sqrt(D)) * 0.5 / A, y = (T - x * x0) / y0;
  if (d(P + pt(x, y), S) <= r3) return 1;
  return 0;
}
bool check(long double m) {
  long double r1 = m, r2 = max(AB + t1 - m, (long double)0),
              r3 = max(AC + t2 - m, (long double)0);
  if (r1 + r2 < AB) return 0;
  if (r2 + r3 < BC) return 0;
  if (r1 + r3 < AC) return 0;
  if (Abs(r1 - r2) >= AB) return 1;
  if (Abs(r2 - r3) >= BC) return 1;
  if (Abs(r1 - r3) >= AC) return 1;
  if (chk(A, r1, B, r2, C, r3)) return 1;
  if (chk(A, r1, C, r3, B, r2)) return 1;
  if (chk(B, r2, C, r3, A, r1)) return 1;
  return 0;
}
int main() {
  if (fin) {
    freopen("t.in", "r", stdin);
    freopen("t.out", "w", stdout);
  }
  long double l, r, m;
  cin >> t1 >> t2 >> A >> C >> B;
  AB = d(A, B), AC = d(A, C), BC = d(B, C);
  l = 0, r = min(AB + BC + t1, AC + t2);
  if (AC + t2 + eps >= AB + BC) return printf("%.12lf", (double)r), 0;
  while (l + 1e-6 < r) {
    m = (l + r) * 0.5;
    if (check(m))
      l = m;
    else
      r = m;
  }
  printf("%.12lf", (double)l);
  return 0;
}