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.util.Scanner;

public class Problem_8D {

    static  double maxDistance(double t1, double t2, Point cinema, Point home, Point shop) {

        double eps = 1e-7;

        double cinemaToShop = shop.Sub(cinema).Dist();
        double cinemaToHome = home.Sub(cinema).Dist();
        double shopToHome = home.Sub(shop).Dist();

        double p1 = cinemaToShop + shopToHome;
        double p2 = cinemaToHome;

        if (p1 < (p2 + t2) || Math.abs(p1 - (p2 + t2)) < eps)
            return Math.min(p1 + t1, p2 + t2);

        double maxD1 = cinemaToShop + t1;
        double maxD2 = cinemaToHome + t2;

        double d1 = maxD1 - cinemaToHome - shopToHome;
        if (d1 > 0 || Math.abs(d1) < eps) {
            double ret = cinemaToHome;
            double tt2 = t2;
            double minP = Math.min(tt2, Math.min(d1, t1));
            ret += minP;
            tt2 -= minP;
            if (tt2 > 0) ret += tt2 * 0.5;
            return ret;
        }

        /////

        Line sh = new Line(home, shop);
        Line shP = sh.GetMidPerp(home, shop);
        shP = shP.MoveLineTo(cinema);
        Point cross = shP.GetCrossPoint(sh);

        double d1cross = shop.Sub(cross).Dist() + cross.Sub(cinema).Dist();
        double d2cross = home.Sub(cross).Dist() + cross.Sub(cinema).Dist();

        if (d1cross < (maxD1 + eps) && d2cross < (maxD2 + eps)) {
            double ret = cross.Sub(cinema).Dist();
            maxD1 -= ret;
            maxD2 -= ret;

            maxD1 -= shop.Sub(cross).Dist();
            maxD2 -= home.Sub(cross).Dist();

            double min = Math.min(maxD1, maxD2);
            ret += min;
            maxD1 -= min;
            maxD2 -= min;
            ret += Math.max(maxD1, maxD2) * 0.5;
            return ret;
        }

        ////

        double ret = 0;


        double min = 0;
        double max =cinemaToHome + cinemaToShop + shopToHome + t1+t2;

        Circle cinemaC = new Circle(cinema, 0);
        Circle shopC = new Circle(shop, 0);
        Circle homeC = new Circle(home, 0);

        while (Math.abs(max - min) > 1e-12) {
            double mid = (max + min) * 0.5;

            //mid = 33;

            cinemaC.Radius = mid+ 1e-13;
            homeC.Radius = Math.max(0, maxD2 - mid)+ 1e-19;
            shopC.Radius = Math.max(0, maxD1 - mid)+ 1e-14;

            if (
                    Int(cinemaC, homeC, shopC)
                            || Int(cinemaC, shopC, homeC)
                            || Int(shopC, cinemaC, homeC)
                            || Int(shopC, homeC, cinemaC)
                            || Int(cinemaC, shopC, homeC)
                            || Int(cinemaC, homeC, shopC)
                    ) {
                min = mid;
            }
            else max = mid;
        }

        return min;
    }

    static boolean  Int(Circle c1, Circle c2, Circle c3) {
        Point[] ret = c1.IsIntersects(c2);
        if (ret == null) return  false;

        double d1 = ret[0].Sub(c3.Center).Dist();
        double d2 = ret[1].Sub(c3.Center).Dist();

        if (d1 < (c3.Radius)) return true;
        if (d2 < (c3.Radius)) return true;

        return false;
    }



    static class Point {
        public Point(double x, double y) {
            X = x;
            Y = y;
        }


        public Point Add(Point other) {
            return Add(other.X, other.Y);
        }

        public Point Mid(Point other) {
            return new Point((this.X + other.X) * 0.5, (this.Y + other.Y) * 0.5);
        }

        public double Dist() {
            return Math.hypot(X, Y);
        }

        public Point Sub(Point other) {
            return Add(-other.X, -other.Y);
        }

        public Point Add(double x, double y) {
            return new Point(this.X + x, this.Y + y);
        }

        public Point Mult(double r) {
            return new Point(this.X * r, this.Y * r);
        }

        public double X;
        public double Y;

        @Override
        public String toString() {
            return String.format("%.5f %.5f", X, Y);
        }
    }


    static class Line {
        public Line(Point start, Point end) {
            double eps = 1e-6;
            if (Math.abs(start.X - end.X) < eps) {
                // vert
                A = 1;
                B = 0;
                C = -start.X;
            } else if (Math.abs(start.Y - end.Y) < eps) {
                // hor
                A = 0;
                B = 1;
                C = -start.Y;
            } else {
                A = end.Y - start.Y;
                B = start.X - end.X;
                C = -A * start.X - B * start.Y;
            }
        }

        public Line(double a, double b, double c) {
            this.A = a;
            this.B = b;
            this.C = c;
        }

        public Point GetCrossPoint(Line other) {
            double xc = -(C * other.B - other.C * B) / (A * other.B - other.A * B);
            double yc = -(A * other.C - other.A * C) / (A * other.B - other.A * B);

            return new Point(xc, yc);
        }

        public Line GetMidPerp(Point start, Point end) {
            double midX = (end.X + start.X) * 0.5;
            double midY = (end.Y + start.Y) * 0.5;

            Line line = new Line(start, end);

            double perpA = -line.B;
            double perpB = line.A;
            double perpC = -perpA * midX - perpB * midY;

            return new Line(perpA, perpB, perpC);
        }

        public Line MoveLineTo(Point p) {
            return new Line(this.A, this.B, -this.A * p.X - this.B * p.Y);
        }

        public double A;
        public double B;
        public double C;
    }

    static class Circle {
        public Circle(Point center, double radius) {
            this.Center = center;
            this.Radius = radius;
        }

        Point[] IsIntersects(Circle other) {
            Circle c12 = this;
            Circle c23 = other;


            double r0 = c12.Radius;
            double r1 = c23.Radius;

            double d = c12.Center.Sub(c23.Center).Dist();
            if (d > (r0 + r1)) return null;
            if (d < Math.abs(r0 - r1)) return null;

            double a = (r0 * r0 - r1 * r1 + d * d) / (2 * d);
            double h = Math.sqrt(r0 * r0 - a * a);

            Point p2 = c12.Center.Add(c23.Center.Sub(c12.Center).Mult(a / d));

            double x31, y31, x32, y32;

            double xc = h * (c23.Center.Y - c12.Center.Y) / d;
            double yc = h * (c23.Center.X - c12.Center.X) / d;

            x31 = p2.X - xc;
            y31 = p2.Y + yc;

            x32 = p2.X + xc;
            y32 = p2.Y - yc;


            Point t1 = new Point(x31, y31);
            Point t2 = new Point(x32, y32);

            return new Point[]{t1, t2};
        }


        public Point Center;
        public double Radius;
    }


    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        double t1 = sc.nextDouble();
        double t2 = sc.nextDouble();
        Point cinema = new Point(sc.nextDouble(), sc.nextDouble());
        Point house = new Point(sc.nextDouble(), sc.nextDouble());
        Point shop = new Point(sc.nextDouble(), sc.nextDouble());

        double l = maxDistance(t1, t2, cinema, house, shop);

        System.out.printf("%.5f", l);

        //System.out.printf("1.00000");

        sc.close();
    }

}

