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;
template <class C>
void mini(C& a4, C b4) {
  a4 = min(a4, b4);
}
template <class C>
void maxi(C& a4, C b4) {
  a4 = max(a4, b4);
}
template <typename T1, typename T2>
ostream& operator<<(ostream& out, pair<T1, T2> pair) {
  out << "(" << pair.first << ", " << pair.second << ")";
  return out;
}
const long double EPS = 1e-9;
const long double EPSa = 1e-12;
inline long double SQR(long double a) { return a * a; }
int main() {
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  complex<long double> x, y, z;
  long double t1, t2;
  long double a, b;
  cin >> t1 >> t2;
  cin >> a >> b;
  x = complex<long double>(a, b);
  cin >> a >> b;
  y = complex<long double>(a, b);
  cin >> a >> b;
  z = complex<long double>(a, b);
  ;
  ;
  ;
  ;
  ;
  ;
  ;
  ;
  if (abs(x - z) + abs(z - y) < abs(x - y) + t2 + EPS) {
    cout << min(abs(x - z) + abs(z - y) + t1, abs(x - y) + t2) << endl;
    return 0;
  }
  long double d1 = abs(x - z) + t1;
  long double d2 = abs(x - y) + t2;
  d1 = min(d1, d2 + abs(y - z));
  d2 = min(d2, d1 + abs(y - z));
  complex<long double> p =
      y + (z - y) / abs(z - y) * ((abs(y - z) + d2 - d1) / 2);
  ;
  ;
  ;
  ;
  ;
  ;
  if (abs(x - p) + abs(p - z) < d1 + EPS) {
    cout << d1 - abs(p - z) << endl;
    return 0;
  }
  long double A = 0, B = abs(x - p), C;
  while (B - A > EPS) {
    C = (A + B) / 2;
    long double cos1 =
        (SQR(C) + norm(x - z) - SQR(d1 - C)) / C / abs(x - z) / 2;
    long double cos2 =
        (SQR(C) + norm(x - y) - SQR(d2 - C)) / C / abs(x - y) / 2;
    long double cos3 =
        (norm(x - z) + norm(x - y) - norm(y - z)) / abs(x - z) / abs(x - y) / 2;
    maxi(cos1, (long double)-1);
    mini(cos1, (long double)1);
    maxi(cos2, (long double)-1);
    mini(cos2, (long double)1);
    maxi(cos3, (long double)-1);
    mini(cos3, (long double)1);
    cos1 = acosl(cos1);
    cos2 = acosl(cos2);
    cos3 = acosl(cos3);
    if (d1 > C * 2 + abs(x - z)) cos1 = 3.14159265358979323846;
    if (d2 > C * 2 + abs(x - y)) cos1 = 3.14159265358979323846;
    ;
    ;
    ;
    if (cos1 + cos2 + EPSa > cos3) {
      A = C;
    } else {
      B = C;
    }
  }
  cout << A << endl;
  return 0;
}