import java.util.*;
public class Main {
    public static void main(String agrs[])
    {
        Scanner in = new Scanner(System.in);
        double a = in.nextDouble();
        double b = in.nextDouble();
        double h = in.nextDouble();
        double m = in.nextDouble();
        h *= 30;
        m *= 6;
        h += m / 12;
        if(m == 0)
        {
            m = 360.0;
        }
        if(h == 0)
        {
            h = 360.0;
        }
        double angle = Math.min(Math.abs(h - m), Math.abs(m - h));
        angle /= 180;
        angle *= Math.PI;
        double hyp = Math.pow(a, 2) + Math.pow(b, 2) - (2 * a * b * Math.cos(angle));
        hyp = Math.sqrt(hyp);
        System.out.println(hyp);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String agrs[])
    {
        Scanner in = new Scanner(System.in);
        double a = in.nextDouble();
        double b = in.nextDouble();
        double h = in.nextDouble();
        double m = in.nextDouble();
        h *= 30;
        m *= 6;
        h += m / 12;
        if(m == 0)
        {
            m = 360.0;
        }
        if(h == 0)
        {
            h = 360.0;
        }
        double angle = Math.min(Math.abs(h - m), Math.abs(m - h));
        angle /= 180;
        angle *= Math.PI;
        double hyp = Math.pow(a, 2) + Math.pow(b, 2) - (2 * a * b * Math.cos(angle));
        hyp = Math.sqrt(hyp);
        System.out.println(hyp);
    }
} Main public static void main(String agrs[])
    {
        Scanner in = new Scanner(System.in);
        double a = in.nextDouble();
        double b = in.nextDouble();
        double h = in.nextDouble();
        double m = in.nextDouble();
        h *= 30;
        m *= 6;
        h += m / 12;
        if(m == 0)
        {
            m = 360.0;
        }
        if(h == 0)
        {
            h = 360.0;
        }
        double angle = Math.min(Math.abs(h - m), Math.abs(m - h));
        angle /= 180;
        angle *= Math.PI;
        double hyp = Math.pow(a, 2) + Math.pow(b, 2) - (2 * a * b * Math.cos(angle));
        hyp = Math.sqrt(hyp);
        System.out.println(hyp);
    } main {
        Scanner in = new Scanner(System.in);
        double a = in.nextDouble();
        double b = in.nextDouble();
        double h = in.nextDouble();
        double m = in.nextDouble();
        h *= 30;
        m *= 6;
        h += m / 12;
        if(m == 0)
        {
            m = 360.0;
        }
        if(h == 0)
        {
            h = 360.0;
        }
        double angle = Math.min(Math.abs(h - m), Math.abs(m - h));
        angle /= 180;
        angle *= Math.PI;
        double hyp = Math.pow(a, 2) + Math.pow(b, 2) - (2 * a * b * Math.cos(angle));
        hyp = Math.sqrt(hyp);
        System.out.println(hyp);
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) double a = in.nextDouble(); a in.nextDouble() in.nextDouble in double b = in.nextDouble(); b in.nextDouble() in.nextDouble in double h = in.nextDouble(); h in.nextDouble() in.nextDouble in double m = in.nextDouble(); m in.nextDouble() in.nextDouble in h *= 30 h 30 m *= 6 m 6 h += m / 12 h m / 12 m 12 if(m == 0)
        {
            m = 360.0;
        } m == 0 m 0 {
            m = 360.0;
        } m = 360.0 m 360.0 if(h == 0)
        {
            h = 360.0;
        } h == 0 h 0 {
            h = 360.0;
        } h = 360.0 h 360.0 double angle = Math.min(Math.abs(h - m), Math.abs(m - h)); angle Math.min(Math.abs(h - m), Math.abs(m - h)) Math.min Math Math.abs(h - m) Math.abs Math h - m h m Math.abs(m - h) Math.abs Math m - h m h angle /= 180 angle 180 angle *= Math.PI angle Math.PI Math Math.PI double hyp = Math.pow(a, 2) + Math.pow(b, 2) - (2 * a * b * Math.cos(angle)); hyp Math.pow(a, 2) + Math.pow(b, 2) - (2 * a * b * Math.cos(angle)) Math.pow(a, 2) + Math.pow(b, 2) Math.pow(a, 2) Math.pow Math a 2 Math.pow(b, 2) Math.pow Math b 2 (2 * a * b * Math.cos(angle)) b 2 * a * b * Math.cos(angle) 2 a b Math.cos(angle) Math.cos Math angle hyp = Math.sqrt(hyp) hyp Math.sqrt(hyp) Math.sqrt Math hyp System.out.println(hyp) System.out.println System.out System System.out hyp String agrs[] agrs public class Main {
    public static void main(String agrs[])
    {
        Scanner in = new Scanner(System.in);
        double a = in.nextDouble();
        double b = in.nextDouble();
        double h = in.nextDouble();
        double m = in.nextDouble();
        h *= 30;
        m *= 6;
        h += m / 12;
        if(m == 0)
        {
            m = 360.0;
        }
        if(h == 0)
        {
            h = 360.0;
        }
        double angle = Math.min(Math.abs(h - m), Math.abs(m - h));
        angle /= 180;
        angle *= Math.PI;
        double hyp = Math.pow(a, 2) + Math.pow(b, 2) - (2 * a * b * Math.cos(angle));
        hyp = Math.sqrt(hyp);
        System.out.println(hyp);
    }
} public class Main {
    public static void main(String agrs[])
    {
        Scanner in = new Scanner(System.in);
        double a = in.nextDouble();
        double b = in.nextDouble();
        double h = in.nextDouble();
        double m = in.nextDouble();
        h *= 30;
        m *= 6;
        h += m / 12;
        if(m == 0)
        {
            m = 360.0;
        }
        if(h == 0)
        {
            h = 360.0;
        }
        double angle = Math.min(Math.abs(h - m), Math.abs(m - h));
        angle /= 180;
        angle *= Math.PI;
        double hyp = Math.pow(a, 2) + Math.pow(b, 2) - (2 * a * b * Math.cos(angle));
        hyp = Math.sqrt(hyp);
        System.out.println(hyp);
    }
} Main
import java.util.*;
public class Main {
    public static void main(String agrs[])
    {
        Scanner in = new Scanner(System.in);
        double a = in.nextDouble();
        double b = in.nextDouble();
        double h = in.nextDouble();
        double m = in.nextDouble();
        h *= 30;
        m *= 6;
        h += m / 12;
        if(m == 0)
        {
            m = 360.0;
        }
        if(h == 0)
        {
            h = 360.0;
        }
        double angle = Math.min(Math.abs(h - m), Math.abs(m - h));
        angle /= 180;
        angle *= Math.PI;
        double hyp = Math.pow(a, 2) + Math.pow(b, 2) - (2 * a * b * Math.cos(angle));
        hyp = Math.sqrt(hyp);
        System.out.println(hyp);
    }
}
