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
import java.io.*;
import java.util.*;
public class D8 {
public static void main(String[] args) throws IOException {
    input.init(System.in);
    PrintWriter out = new PrintWriter(System.out);
    double t1 = input.nextInt(), t2 = input.nextInt();
    Point cinema = new Point(input.nextInt(), input.nextInt());
    Point house = new Point(input.nextInt(), input.nextInt());
    Point shop = new Point(input.nextInt(), input.nextInt());
    t1 += cinema.dist(shop) + shop.dist(house);
    t2 += cinema.dist(house);
    //out.println(t1+" "+t2+" "+cinema.dist(shop)+" "+shop.dist(house));
    if(t2 >= cinema.dist(shop) + shop.dist(house)) 
    {
        //out.println("HI");
        out.println(Math.min(t1, t2));
    }
    else
    {
        //System.out.println(t1+" "+t2+" "+shop.dist(house));
        double lo = 0, hi = Math.min(t1, t2);
        //out.println(lo+" "+hi);
        for(int iter = 0; iter < 100; iter++)
        {
            double mid = (lo+hi)/2;
            Circle a = new Circle(cinema.x, cinema.y, mid);
            Circle b = new Circle(shop.x, shop.y, Math.max(0, t1 - shop.dist(house) - mid));
            Circle c = new Circle(house.x, house.y, Math.max(0, t2 - mid));
            if(intersect(new Circle[]{a, b, c})) lo = mid;
            else hi = mid;
        }
        out.println((lo+hi)/2);
    }
    
    out.close();
}
static boolean intersect(Circle[] cs)
{
    ArrayList<Point> cand = new ArrayList<Point>();
    for(int i = 0; i<3; i++)
    {
        cand.add(new Point(cs[i].x, cs[i].y));
        for(int j = 0; j<i; j++)
        {
            if(cs[i].r == 0 || cs[j].r == 0) continue;
            Point[] ps = cs[i].intersect(cs[j]);
            //System.out.println(i+" "+j+" "+ps.length);
            for(Point p : ps) cand.add(p);
        }
    }
    for(Point p : cand)
    {
        //System.out.println(p.x+" "+p.y);
        boolean good = true;
        for(int i = 0; i<3; i++)
        {
            double dist2 = p.dist2(new Point(cs[i].x, cs[i].y));
            if(dist2 > cs[i].r*cs[i].r + 1e-9) good = false;
        }
        if(good)
        {
            return true;
        }
    }
    //System.out.println(Arrays.toString(cs));
    return false;
}
public static class Circle
{
    double x, y, r;
    public Circle(double x, double y, double r)
    {
        this.x = x;
        this.y = y;
        this.r = r;
    }
    public Point[] intersect(Circle c)
    {
        Point diff = new Point(c.x-x, c.y-y);
        double dsq = diff.magSquared();
        double cos = (dsq+r*r-c.r*c.r)/(2*r*diff.mag());
        //System.out.println(cos);
        if(Math.abs(cos-1) < 1e-9) cos = 1;
        if(Math.abs(cos+1) < 1e-9) cos = -1; 
        if(Math.abs(cos) > 1) return new Point[0];
        double theta = Math.acos(cos);
        if(Math.abs(theta) < 1e-9) return new Point[]{diff.normalize().mult(r).plus(new Point(x,y))};
        Point[] ret = new Point[2];
        ret[0] = diff.normalize().mult(r).rotate(theta).plus(new Point(x, y));
        ret[1] = diff.normalize().mult(r).rotate(-theta).plus(new Point(x, y));
        return ret;
    }
    public String toString()
    {
        return x+" "+y+" "+r;
    }

}
public static class Point
{
    double x, y; //x and y represent the coordinates of a point or the components of a vector
    public Point(double myx, double myy)
    {
        x = myx; y = myy;
    }
    //returns this + that
    public Point plus(Point p)
    {
        return new Point(this.x+p.x, this.y+p.y);
    }
    //returns this - that
    public Point minus(Point p)
    {
        return new Point(this.x-p.x,this.y-p.y);
    }
    //scales vector by multiple of d
    public Point mult(double d)
    {
        return new Point(this.x*d, this.y*d);
    }
    //returns magnitude squared of vector
    public double magSquared()
    {
        return this.x*this.x + this.y*this.y;
    }
    //returns magnitude of vector
    public double mag()
    {
        return Math.sqrt(magSquared());
    }
    //rotates vector clockwise by angle theta
    public Point rotate(double theta)
    {
        double nx = x*Math.cos(theta) - y*Math.sin(theta);
        double ny = x*Math.sin(theta) + y*Math.cos(theta);
        return new Point(nx, ny);
    }
    //returns unit vector
    public Point normalize()
    {
        double d = mag();
        return new Point(x/d, y/d);
    }
    double dist2(Point p)
    {
        return this.minus(p).magSquared();
    }
    public double dist(Point p)
    {
        return this.minus(p).mag();
    }
}
public static class input {
    static BufferedReader reader;
    static StringTokenizer tokenizer;

    static void init(InputStream input) {
        reader = new BufferedReader(new InputStreamReader(input));
        tokenizer = new StringTokenizer("");
    }

    static String next() throws IOException {
        while (!tokenizer.hasMoreTokens())
            tokenizer = new StringTokenizer(reader.readLine());
        return tokenizer.nextToken();
    }

    static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static long nextLong() throws IOException {
        return Long.parseLong(next());
    }
}
}
