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-7;
double t1, t2;
struct POINT {
  double x, y;
} home, shop, start;
inline double dis(POINT a, POINT b) {
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
double ans = 0;
void work1() {
  double ori_dis1 = dis(start, home);
  double now_dis1 = dis(start, shop) + dis(shop, home);
  if (now_dis1 - ori_dis1 <= t1 + EPS) ans = min(ori_dis1 + t1, now_dis1 + t2);
}
inline void Update(double x, double y, double &Dis) {
  POINT tmp;
  tmp.x = x;
  tmp.y = y;
  if (dis(tmp, start) < Dis) Dis = dis(tmp, start);
}
inline bool In(POINT a, POINT o, double r) { return dis(a, o) <= r; }
bool chk(double mid) {
  double r1 = dis(start, home) + t1 - mid;
  double r2 = dis(start, shop) + t2 - mid;
  if (r1 + r2 < dis(home, shop)) return false;
  double a = 2 * (shop.x - home.x);
  double b = 2 * (shop.y - home.y);
  double c = r1 * r1 - r2 * r2 + shop.x * shop.x + shop.y * shop.y -
             home.x * home.x - home.y * home.y;
  double d = c / a - home.x;
  double A = b * b / a / a + 1, B = -(2 * home.y + 2 * b * d / a),
         C = d * d + home.y * home.y - r1 * r1;
  double Det = sqrt(fabs(B * B - 4 * A * C));
  double Dis = 1000000;
  double xx, yy;
  yy = (-B + Det) / 2 / A;
  xx = (c - b * yy) / a;
  Update(xx, yy, Dis);
  yy = (-B - Det) / 2 / A;
  xx = (c - b * yy) / a;
  Update(xx, yy, Dis);
  if (Dis <= mid) return true;
  POINT tmp;
  double d1 = dis(start, home);
  tmp.x = home.x + r1 / d1 * (start.x - home.x);
  tmp.y = home.y + r1 / d1 * (start.y - home.y);
  if (In(tmp, shop, r2)) Update(tmp.x, tmp.y, Dis);
  d1 = dis(start, shop);
  tmp.x = shop.x + r2 / d1 * (start.x - shop.x);
  tmp.y = shop.y + r2 / d1 * (start.y - shop.y);
  if (In(tmp, home, r1)) Update(tmp.x, tmp.y, Dis);
  if (Dis <= mid) return true;
  return false;
}
void work2() {
  double l = 0, r = dis(start, home) + t1;
  while (r - l > EPS) {
    double mid = (l + r) / 2;
    if (chk(mid))
      l = mid;
    else
      r = mid;
  }
  ans = (l + r) / 2;
}
int main() {
  cin >> t2 >> t1;
  cin >> start.x >> start.y;
  cin >> home.x >> home.y;
  cin >> shop.x >> shop.y;
  work1();
  if (ans != 0) {
    cout << setiosflags(ios::fixed) << setprecision(8) << ans << endl;
  } else {
    if (home.x == shop.x) {
      swap(start.x, start.y);
      swap(shop.x, shop.y);
      swap(home.x, home.y);
    }
    work2();
    cout << setiosflags(ios::fixed) << setprecision(8) << ans << endl;
  }
  return 0;
}