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 double eps = 1e-8;
complex<double> A, B, C;
double Ta, Tb, La, Lb;
void Read(complex<double> &x) {
  double a, b;
  scanf("%lf%lf", &a, &b);
  x = complex<double>(a, b);
}
bool inter(complex<double> A, double R1, complex<double> B, double R2,
           complex<double> C, double R3) {
  if (abs(C - A) <= R1 && abs(C - B) <= R2) return 1;
  B -= A;
  C -= A;
  complex<double> a = complex<double>(B.real() / abs(B), B.imag() / abs(B));
  B /= a;
  C /= a;
  double x = (R1 * R1 - R2 * R2 + abs(B) * abs(B)) / (2 * abs(B));
  double y = sqrt(max(R1 * R1 - x * x, 0.0));
  if (abs(y * y + (x - abs(B)) * (x - abs(B))) - R2 * R2 > eps) return 0;
  if ((abs(complex<double>(x, y) - C) <= R3) ||
      (abs(complex<double>(x, -y) - C) <= R3))
    return 1;
  return 0;
}
bool check(double x) {
  double R1 = max(x, 0.0), R2 = max(abs(B - A) + Ta - x, 0.0),
         R3 = max(abs(C - A) + Tb - x, 0.0);
  if (R1 <= eps || R2 <= eps || R3 <= eps) return 0;
  if (inter(A, R1, C, R3, B, R2)) return 1;
  if (inter(B, R2, A, R1, C, R3)) return 1;
  return inter(C, R3, B, R2, A, R1);
}
int main() {
  scanf("%lf%lf", &Ta, &Tb);
  Read(A);
  Read(C);
  Read(B);
  La = abs(A - B) + abs(C - B);
  Lb = abs(A - C);
  if (La <= Lb + Tb) {
    printf("%.6lf", min(La + Ta, Lb + Tb));
    return 0;
  }
  double L = 0, R = min(La + Ta, Lb + Tb), mid;
  while (R - L >= eps) {
    mid = (L + R) / 2;
    if (check(mid))
      L = mid;
    else
      R = mid;
  }
  printf("%.6lf", L);
  return 0;
}