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 long double eps = 1e-12;
long double L1, L2, AC, AB, BC;
struct point {
  long double x, y;
  point(){};
  point(long double _x, long double _y) {
    x = _x;
    y = _y;
  }
} A, B, C;
struct circle {
  point o;
  long double r;
  circle(){};
  circle(point _o, long double _r) {
    o = _o;
    r = _r;
  }
};
long double dis(point a, point b) {
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
void init() {
  int t1, t2;
  scanf("%d%d", &t1, &t2);
  scanf("%Lf%Lf", &A.x, &A.y);
  scanf("%Lf%Lf", &C.x, &C.y);
  scanf("%Lf%Lf", &B.x, &B.y);
  AC = dis(A, C);
  AB = dis(A, B);
  BC = dis(B, C);
  L1 = AB + BC + t1;
  L2 = AC + t2;
}
bool seperate(circle c1, circle c2) {
  return dis(c1.o, c2.o) > c1.r + c2.r + eps;
}
bool include(circle c1, circle c2) {
  return dis(c1.o, c2.o) < fabs(c1.r - c2.r);
}
void show(point d) { printf("%Lf %Lf\n", d.x, d.y); }
bool check(circle c1, circle c2, circle c3) {
  point A = c1.o, B = c2.o, C;
  long double AB = dis(c1.o, c2.o), AD = c1.r, BD = c2.r;
  long double cosA = (AB * AB + AD * AD - BD * BD) / (2 * AB * AD);
  if (cosA > 1) cosA = 1;
  long double AC = AD * cosA;
  C.x = A.x + (B.x - A.x) / AB * AC;
  C.y = A.y + (B.y - A.y) / AB * AC;
  long double CD = AD * sqrt(1 - cosA * cosA);
  long double k;
  if (B.y == A.y)
    k = 0x3f3f3f3f;
  else
    k = -(B.x - A.x) / (B.y - A.y);
  point D1, D2;
  D1.x = C.x + CD / sqrt(k * k + 1);
  D1.y = C.y + CD * k / sqrt(k * k + 1);
  D2.x = C.x - CD / sqrt(k * k + 1);
  D2.y = C.y - CD * k / sqrt(k * k + 1);
  return (dis(D1, c3.o) <= c3.r || dis(D2, c3.o) <= c3.r);
}
bool judge(long double x) {
  circle c1(A, x);
  circle c2(B, L1 - BC - x);
  circle c3(C, L2 - x);
  if (seperate(c1, c2) || seperate(c1, c3) || seperate(c2, c3)) return false;
  if (include(c1, c2) || include(c1, c3) || include(c2, c3)) return true;
  return (check(c1, c2, c3) || check(c1, c3, c2) || check(c2, c3, c1));
}
int main() {
  init();
  if (L2 >= AB + BC)
    printf("%.10Lf", min(L1, L2));
  else {
    long double l = 0, r = min(L1 - BC, L2);
    while (r - l >= eps) {
      long double mid = (l + r) / 2;
      if (judge(mid))
        l = mid;
      else
        r = mid;
    }
    printf("%.10Lf", (l + r) / 2);
  }
}