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-10;
struct Tpoint {
  long double x, y;
  void input() {
    double _x, _y;
    scanf("%lf%lf", &_x, &_y);
    x = _x;
    y = _y;
  }
} C, H, S;
double t1, t2;
long double T1, T2;
long double ret;
long double Fabs(long double x) { return x < 0 ? -x : x; }
long double Fmin(long double x, long double y) { return x < y ? x : y; }
long double Fmax(long double x, long double y) { return x > y ? x : y; }
long double dist2(Tpoint a, Tpoint b) {
  return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
}
long double dist(Tpoint a, Tpoint b) { return sqrt(Fabs(dist2(a, b))); }
void init() {
  scanf("%lf%lf", &t1, &t2);
  C.input();
  H.input();
  S.input();
}
bool Inside(Tpoint A, long double r, Tpoint p) {
  return dist2(A, p) < r * r + eps;
}
bool inter(Tpoint A, Tpoint B, long double ra, long double rb) {
  return dist(A, B) < ra + rb + eps;
}
void Normalize(long double &x) {
  if (x > 1.0) x = 1.0;
  if (x < -1.0) x = -1.0;
}
bool inter(Tpoint A, Tpoint B, Tpoint C, long double ra, long double rb,
           long double rc) {
  if (dist(A, B) < Fabs(ra - rb) + eps) return 1;
  long double alpha = atan2(B.y - A.y, B.x - A.x);
  long double dis2 = dist2(A, B);
  long double cosine =
      (ra * ra + dis2 - rb * rb) / (2.0 * ra * sqrt(Fabs(dis2)));
  Normalize(cosine);
  long double beta = acos(cosine);
  Tpoint p;
  p.x = A.x + ra * cos(alpha + beta);
  p.y = A.y + ra * sin(alpha + beta);
  if (Inside(C, rc, p)) return 1;
  p.x = A.x + ra * cos(alpha - beta);
  p.y = A.y + ra * sin(alpha - beta);
  if (Inside(C, rc, p)) return 1;
  return 0;
}
bool check(long double cur) {
  long double rc = cur, rh = Fmax(0, T2 - cur),
              rs = Fmax(0, T1 - cur - dist(S, H));
  if (!inter(C, H, rc, rh) || !inter(C, S, rc, rs) || !inter(H, S, rh, rs))
    return 0;
  if (inter(C, H, S, rc, rh, rs)) return 1;
  if (inter(C, S, H, rc, rs, rh)) return 1;
  if (inter(H, S, C, rh, rs, rc)) return 1;
  return 0;
}
long double solve() {
  T1 = dist(C, S) + dist(S, H) + t1;
  T2 = dist(C, H) + t2;
  if (T1 - t1 < T2 + eps) return Fmin(T1, T2);
  long double L = 0, r = Fmin(T1, T2);
  for (int it = 0; it < 100; it++) {
    long double mid = (L + r) / 2;
    if (check(mid))
      L = mid;
    else
      r = mid;
  }
  return L;
}
void print() { printf("%.10lf\n", (double)solve()); }
int main() {
  init();
  print();
  return 0;
}