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 Vector {
  long double x, y;
  Vector(long double _x = 0, long double _y = 0) : x(_x), y(_y) {}
  Vector operator+(const Vector& rhs) const {
    return Vector(x + rhs.x, y + rhs.y);
  }
  Vector operator-(const Vector& rhs) const {
    return Vector(x - rhs.x, y - rhs.y);
  }
  Vector Rotate(long double theta) {
    long double nx = x * cos(theta) - y * sin(theta);
    long double ny = x * sin(theta) + y * cos(theta);
    return Vector(nx, ny);
  }
  long double len() { return sqrt(x * x + y * y); }
  long double len2() { return x * x + y * y; }
  void Read() { cin >> x >> y; }
};
struct Rad {
  double r;
  Vector O;
} lis[3];
long double Opt_val(long double u) {
  if (u < -1) return -1;
  if (u > 1) return 1;
  return u;
}
long double sqr(long double u) { return u * u; }
vector<Vector> inter_lis;
void getInter(Rad a, Rad b) {
  if (a.r + b.r + eps < (a.O - b.O).len()) return;
  if (a.r < b.r) swap(a, b);
  if (a.r > (a.O - b.O).len() + b.r) {
    inter_lis.push_back(a.O);
    inter_lis.push_back(b.O);
    return;
  }
  Vector vec = a.O - b.O;
  long double theta =
      acos(Opt_val((vec.len2() + sqr(b.r) - sqr(a.r)) / (2 * vec.len() * b.r)));
  long double cur_len = vec.len();
  vec.x /= cur_len, vec.y /= cur_len;
  vec.x *= b.r, vec.y *= b.r;
  inter_lis.push_back(b.O + vec.Rotate(theta));
  inter_lis.push_back(b.O + vec.Rotate(-theta));
}
bool check() {
  inter_lis.clear();
  for (int i = 0; i < 3; i++) {
    for (int j = i + 1; j < 3; j++) {
      getInter(lis[i], lis[j]);
    }
  }
  for (int i = 0; i < (int)inter_lis.size(); i++) {
    bool ok = true;
    for (int j = 0; j < 3; j++) {
      long double cur_len = (inter_lis[i] - lis[j].O).len();
      if (cur_len > lis[j].r + eps) ok = false;
    }
    if (ok) return true;
  }
  return false;
}
int main() {
  long double t1, t2;
  cin >> t1 >> t2;
  for (int i = 0; i < 3; i++) lis[i].O.Read();
  t1 += (lis[0].O - lis[2].O).len();
  t1 += (lis[1].O - lis[2].O).len();
  t2 += (lis[1].O - lis[0].O).len();
  if (t2 + eps >= (lis[0].O - lis[2].O).len() + (lis[1].O - lis[2].O).len()) {
    printf("%.10f\n", (double)min(t1, t2));
    return 0;
  }
  t1 -= (lis[1].O - lis[2].O).len();
  long double L = 0, R = min(t1, t2);
  while (R - L > eps) {
    long double mid = (L + R) / 2;
    lis[0].r = mid;
    lis[1].r = t2 - mid;
    lis[2].r = t1 - mid;
    if (check())
      L = mid;
    else
      R = mid;
  }
  printf("%.10f\n", (double)L);
  return 0;
}