import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);
    static double A = sc.nextDouble();
    static double B = sc.nextDouble();
    static double H = sc.nextDouble();
    static double M = sc.nextDouble();

    public static void main(String[] args) {
        //角度を求める
        double kHour = (H + (M / 60)) * 30;
        double kMin = M * 6;
        double kakudo = Math.abs(kHour - kMin);
        double dC = Math.pow(A, 2) + Math.pow(B, 2) - 2 * A * B * Math.cos(Math.toRadians(kakudo));
        BigDecimal x = new BigDecimal(Math.sqrt(dC));
        MathContext mc = new MathContext(50, RoundingMode.UP);
        BigDecimal result = x.round(mc);
        System.out.print(result);



    }

} import java.math.BigDecimal; BigDecimal java.math import java.math.MathContext; MathContext java.math import java.math.RoundingMode; RoundingMode java.math import java.util.Scanner; Scanner java.util public class Main {
    static Scanner sc = new Scanner(System.in);
    static double A = sc.nextDouble();
    static double B = sc.nextDouble();
    static double H = sc.nextDouble();
    static double M = sc.nextDouble();

    public static void main(String[] args) {
        //角度を求める
        double kHour = (H + (M / 60)) * 30;
        double kMin = M * 6;
        double kakudo = Math.abs(kHour - kMin);
        double dC = Math.pow(A, 2) + Math.pow(B, 2) - 2 * A * B * Math.cos(Math.toRadians(kakudo));
        BigDecimal x = new BigDecimal(Math.sqrt(dC));
        MathContext mc = new MathContext(50, RoundingMode.UP);
        BigDecimal result = x.round(mc);
        System.out.print(result);



    }

} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) static double A = sc.nextDouble(); A sc.nextDouble() sc.nextDouble sc static double B = sc.nextDouble(); B sc.nextDouble() sc.nextDouble sc static double H = sc.nextDouble(); H sc.nextDouble() sc.nextDouble sc static double M = sc.nextDouble(); M sc.nextDouble() sc.nextDouble sc public static void main(String[] args) {
        //角度を求める
        double kHour = (H + (M / 60)) * 30;
        double kMin = M * 6;
        double kakudo = Math.abs(kHour - kMin);
        double dC = Math.pow(A, 2) + Math.pow(B, 2) - 2 * A * B * Math.cos(Math.toRadians(kakudo));
        BigDecimal x = new BigDecimal(Math.sqrt(dC));
        MathContext mc = new MathContext(50, RoundingMode.UP);
        BigDecimal result = x.round(mc);
        System.out.print(result);



    } main {
        //角度を求める
        double kHour = (H + (M / 60)) * 30;
        double kMin = M * 6;
        double kakudo = Math.abs(kHour - kMin);
        double dC = Math.pow(A, 2) + Math.pow(B, 2) - 2 * A * B * Math.cos(Math.toRadians(kakudo));
        BigDecimal x = new BigDecimal(Math.sqrt(dC));
        MathContext mc = new MathContext(50, RoundingMode.UP);
        BigDecimal result = x.round(mc);
        System.out.print(result);



    } double kHour = (H + (M / 60)) * 30; kHour (H + (M / 60)) * 30 (H + (M / 60)) H (M / 60) M 60 30 double kMin = M * 6; kMin M * 6 M 6 double kakudo = Math.abs(kHour - kMin); kakudo Math.abs(kHour - kMin) Math.abs Math kHour - kMin kHour kMin double dC = Math.pow(A, 2) + Math.pow(B, 2) - 2 * A * B * Math.cos(Math.toRadians(kakudo)); dC Math.pow(A, 2) + Math.pow(B, 2) - 2 * A * B * Math.cos(Math.toRadians(kakudo)) 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(Math.toRadians(kakudo)) B 2 * A * B * Math.cos(Math.toRadians(kakudo)) 2 A B Math.cos(Math.toRadians(kakudo)) Math.cos Math Math.toRadians(kakudo) Math.toRadians Math kakudo BigDecimal x = new BigDecimal(Math.sqrt(dC)); x new BigDecimal(Math.sqrt(dC)) MathContext mc = new MathContext(50, RoundingMode.UP); mc new MathContext(50, RoundingMode.UP) BigDecimal result = x.round(mc); result x.round(mc) x.round x mc System.out.print(result) System.out.print System.out System System.out result String[] args args public class Main {
    static Scanner sc = new Scanner(System.in);
    static double A = sc.nextDouble();
    static double B = sc.nextDouble();
    static double H = sc.nextDouble();
    static double M = sc.nextDouble();

    public static void main(String[] args) {
        //角度を求める
        double kHour = (H + (M / 60)) * 30;
        double kMin = M * 6;
        double kakudo = Math.abs(kHour - kMin);
        double dC = Math.pow(A, 2) + Math.pow(B, 2) - 2 * A * B * Math.cos(Math.toRadians(kakudo));
        BigDecimal x = new BigDecimal(Math.sqrt(dC));
        MathContext mc = new MathContext(50, RoundingMode.UP);
        BigDecimal result = x.round(mc);
        System.out.print(result);



    }

} public class Main {
    static Scanner sc = new Scanner(System.in);
    static double A = sc.nextDouble();
    static double B = sc.nextDouble();
    static double H = sc.nextDouble();
    static double M = sc.nextDouble();

    public static void main(String[] args) {
        //角度を求める
        double kHour = (H + (M / 60)) * 30;
        double kMin = M * 6;
        double kakudo = Math.abs(kHour - kMin);
        double dC = Math.pow(A, 2) + Math.pow(B, 2) - 2 * A * B * Math.cos(Math.toRadians(kakudo));
        BigDecimal x = new BigDecimal(Math.sqrt(dC));
        MathContext mc = new MathContext(50, RoundingMode.UP);
        BigDecimal result = x.round(mc);
        System.out.print(result);



    }

} Main
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.util.Scanner;

public class Main {
    static Scanner sc = new Scanner(System.in);
    static double A = sc.nextDouble();
    static double B = sc.nextDouble();
    static double H = sc.nextDouble();
    static double M = sc.nextDouble();

    public static void main(String[] args) {
        //角度を求める
        double kHour = (H + (M / 60)) * 30;
        double kMin = M * 6;
        double kakudo = Math.abs(kHour - kMin);
        double dC = Math.pow(A, 2) + Math.pow(B, 2) - 2 * A * B * Math.cos(Math.toRadians(kakudo));
        BigDecimal x = new BigDecimal(Math.sqrt(dC));
        MathContext mc = new MathContext(50, RoundingMode.UP);
        BigDecimal result = x.round(mc);
        System.out.print(result);



    }

}