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
#include <bits/stdc++.h>
using namespace std;
class Point;
class Circle;
int get_deviation(double a, double b);
double mysqrt(double x);
class Point {
 public:
  double x, y;

 public:
  Point(double i, double j) : x(i), y(j) {}
  Point() {}

 public:
  double length2() const;
  double length() const;
  bool is_in(const Circle &C) const;

 public:
  friend Point operator-(const Point &A, const Point &B);
  friend Point operator/(const Point &A, const Point &B);
  friend bool operator==(const Point &A, const Point &B);
  friend bool operator!=(const Point &A, const Point &B);
  friend double get_distance(const Point &A, const Point &B);
  friend double get_dot(const Point &A, const Point &B);
  friend bool have_intersection(Circle A, Circle B, Circle C);
};
class Circle {
 public:
  Point center;
  double radius;

 public:
  Circle(Point c, double r) : center(c), radius(r) {}
  Circle() {}

 public:
  friend bool have_intersection(Circle A, Circle B, Circle C);
};
double solve();
bool check();
const double EPS = 1e-9;
double t1, t2;
double d_cs, d_sh, d_ch;
double d1, d2;
Point cinema, house, shop;
Circle circles[3];
int main() {
  scanf("%lf %lf", &t1, &t2);
  scanf("%lf %lf", &cinema.x, &cinema.y);
  scanf("%lf %lf", &house.x, &house.y);
  scanf("%lf %lf", &shop.x, &shop.y);
  d_cs = get_distance(cinema, shop);
  d_sh = get_distance(shop, house);
  d_ch = get_distance(cinema, house);
  d1 = d_cs + d_sh;
  d2 = d_ch;
  double res = solve();
  printf("%lf\n", res);
  return 0;
}
double solve() {
  if (d2 + t2 >= d1) {
    return min(d1 + t1, d2 + t2);
  }
  double left = 0, right = min(d1, d2 + t2);
  while (get_deviation(left, right) < 0) {
    double mid = (left + right) / 2;
    circles[0] = Circle(cinema, mid);
    circles[1] = Circle(house, d_ch + t2 - mid);
    circles[2] = Circle(shop, d_cs + t1 - mid);
    if (check())
      left = mid;
    else
      right = mid;
  }
  return left;
}
bool check() {
  for (int i = 0; i < 3; i++) {
    if (get_deviation(circles[i].radius, 0) == 0) return false;
  }
  for (int i = 0; i < 3; i++) {
    int j = (i + 1) % 3;
    int k = (i + 2) % 3;
    if (have_intersection(circles[i], circles[j], circles[k])) return true;
  }
  return false;
}
int get_deviation(double a, double b) {
  double delta = a - b;
  if (abs(delta) < EPS) return 0;
  return (delta > 0 ? 1 : -1);
}
void tf_limit(double &cosx) { cosx = max(min(cosx, 1.0), -1.0); }
double Point::length2() const { return x * x + y * y; }
double Point::length() const { return sqrt(length2()); }
bool Point::is_in(const Circle &C) const {
  double delta = (C.center - *this).length();
  return (get_deviation(delta, C.radius) <= 0);
}
Point operator-(const Point &A, const Point &B) {
  return Point(A.x - B.x, A.y - B.y);
}
Point operator/(const Point &A, const Point &B) {
  Point P(A.x * B.x + A.y * B.y, A.y * B.x - A.x * B.y);
  P.x /= B.length2();
  P.y /= B.length2();
  return P;
}
bool operator==(const Point &A, const Point &B) {
  return (get_deviation(A.x, B.x) == 0 && get_deviation(A.y, B.y) == 0);
}
bool operator!=(const Point &A, const Point &B) { return !(A == B); }
double get_distance(const Point &A, const Point &B) { return (A - B).length(); }
double get_dot(const Point &A, const Point &B) {
  return (A.x * B.x + A.y * B.y);
}
bool ac_have_intersection(Circle A, Circle B, Circle C) {
  if ((A.center - C.center).length() <= A.radius &&
      (B.center - C.center).length() <= B.radius)
    return true;
  B.center = B.center - A.center;
  C.center = C.center - A.center;
  A.center = A.center - A.center;
  Point R(B.center.x / B.center.length(), B.center.y / B.center.length());
  B.center = B.center / R;
  C.center = C.center / R;
  double x = (A.radius * A.radius - B.radius * B.radius + B.center.length2()) /
             (2 * B.center.length());
  double y = sqrt(max(A.radius * A.radius - x * x, 0.0));
  Point p1(x, y), p2(x, -y);
  if (get_deviation(y * y + (B.center.length() - x) * (B.center.length() - x),
                    B.radius * B.radius) != 0)
    return false;
  if ((p1 - C.center).length() <= C.radius ||
      (p2 - C.center).length() <= C.radius)
    return true;
  return false;
}
bool wa_have_intersection(Circle A, Circle B, Circle C) {
  double delta = (A.center - B.center).length();
  int dev_in = get_deviation(delta, abs(A.radius - B.radius));
  int dev_out = get_deviation(delta, abs(A.radius + B.radius));
  if (dev_in < 0) return true;
  if (dev_out > 0) return false;
  double cosa = (B.center.x - A.center.x) / delta;
  double cosb = (A.radius * A.radius + delta * delta - B.radius * B.radius) /
                (2 * A.radius * delta);
  tf_limit(cosa);
  tf_limit(cosb);
  double sina = sqrt(1 - cosa * cosa);
  double sinb = sqrt(1 - cosb * cosb);
  tf_limit(sina);
  tf_limit(sinb);
  double cosS1 = cosa * cosb - sina * sinb;
  double cosS2 = cosa * cosb + sina * sinb;
  tf_limit(cosS1);
  tf_limit(cosS2);
  double sinS1 = sqrt(1 - cosS1 * cosS1);
  double sinS2 = sqrt(1 - cosS2 * cosS2);
  tf_limit(sinS1);
  tf_limit(sinS2);
  Point p1(A.center.x + A.radius * cosS1, A.center.y + A.radius * sinS1);
  Point p2(A.center.x + A.radius * cosS2, A.center.y + A.radius * sinS2);
  if (p1.is_in(C) || p2.is_in(C)) return true;
  return false;
}
bool have_intersection(Circle A, Circle B, Circle C) {
  return ac_have_intersection(A, B, C);
}
