
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 int A = sc.nextInt();
    static int B = sc.nextInt();
    static int H = sc.nextInt();
    static int M = sc.nextInt();

    public static void main(String[] args) {
        //角度を求める
        double kHour = H * 30 + M * 0.5;
        double kMin = M * 6;
        double kakudo = kHour - kMin;
        if (kakudo > 180){
            kakudo = 360 - kakudo;
        } else if (kakudo < 0){
            kakudo *= -1;
        }
        double dC = A * A + B * B - 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);
        double result = Math.sqrt(dC);
        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 int A = sc.nextInt();
    static int B = sc.nextInt();
    static int H = sc.nextInt();
    static int M = sc.nextInt();

    public static void main(String[] args) {
        //角度を求める
        double kHour = H * 30 + M * 0.5;
        double kMin = M * 6;
        double kakudo = kHour - kMin;
        if (kakudo > 180){
            kakudo = 360 - kakudo;
        } else if (kakudo < 0){
            kakudo *= -1;
        }
        double dC = A * A + B * B - 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);
        double result = Math.sqrt(dC);
        System.out.print(result);

    }

} Main static Scanner sc = new Scanner(System.in); sc new Scanner(System.in) static int A = sc.nextInt(); A sc.nextInt() sc.nextInt sc static int B = sc.nextInt(); B sc.nextInt() sc.nextInt sc static int H = sc.nextInt(); H sc.nextInt() sc.nextInt sc static int M = sc.nextInt(); M sc.nextInt() sc.nextInt sc public static void main(String[] args) {
        //角度を求める
        double kHour = H * 30 + M * 0.5;
        double kMin = M * 6;
        double kakudo = kHour - kMin;
        if (kakudo > 180){
            kakudo = 360 - kakudo;
        } else if (kakudo < 0){
            kakudo *= -1;
        }
        double dC = A * A + B * B - 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);
        double result = Math.sqrt(dC);
        System.out.print(result);

    } main {
        //角度を求める
        double kHour = H * 30 + M * 0.5;
        double kMin = M * 6;
        double kakudo = kHour - kMin;
        if (kakudo > 180){
            kakudo = 360 - kakudo;
        } else if (kakudo < 0){
            kakudo *= -1;
        }
        double dC = A * A + B * B - 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);
        double result = Math.sqrt(dC);
        System.out.print(result);

    } double kHour = H * 30 + M * 0.5; kHour H * 30 + M * 0.5 H * 30 H 30 M * 0.5 M 0.5 double kMin = M * 6; kMin M * 6 M 6 double kakudo = kHour - kMin; kakudo kHour - kMin kHour kMin if (kakudo > 180){
            kakudo = 360 - kakudo;
        } else if (kakudo < 0){
            kakudo *= -1;
        } kakudo > 180 kakudo 180 {
            kakudo = 360 - kakudo;
        } kakudo = 360 - kakudo kakudo 360 - kakudo 360 kakudo if (kakudo < 0){
            kakudo *= -1;
        } kakudo < 0 kakudo 0 {
            kakudo *= -1;
        } kakudo *= -1 kakudo -1 1 double dC = A * A + B * B - 2 * A * B * Math.cos(Math.toRadians(kakudo)); dC A * A + B * B - 2 * A * B * Math.cos(Math.toRadians(kakudo)) A * A + B * B A * A A A B * B B B 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 double result = Math.sqrt(dC); result Math.sqrt(dC) Math.sqrt Math dC 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 int A = sc.nextInt();
    static int B = sc.nextInt();
    static int H = sc.nextInt();
    static int M = sc.nextInt();

    public static void main(String[] args) {
        //角度を求める
        double kHour = H * 30 + M * 0.5;
        double kMin = M * 6;
        double kakudo = kHour - kMin;
        if (kakudo > 180){
            kakudo = 360 - kakudo;
        } else if (kakudo < 0){
            kakudo *= -1;
        }
        double dC = A * A + B * B - 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);
        double result = Math.sqrt(dC);
        System.out.print(result);

    }

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

    public static void main(String[] args) {
        //角度を求める
        double kHour = H * 30 + M * 0.5;
        double kMin = M * 6;
        double kakudo = kHour - kMin;
        if (kakudo > 180){
            kakudo = 360 - kakudo;
        } else if (kakudo < 0){
            kakudo *= -1;
        }
        double dC = A * A + B * B - 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);
        double result = Math.sqrt(dC);
        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 int A = sc.nextInt();
    static int B = sc.nextInt();
    static int H = sc.nextInt();
    static int M = sc.nextInt();

    public static void main(String[] args) {
        //角度を求める
        double kHour = H * 30 + M * 0.5;
        double kMin = M * 6;
        double kakudo = kHour - kMin;
        if (kakudo > 180){
            kakudo = 360 - kakudo;
        } else if (kakudo < 0){
            kakudo *= -1;
        }
        double dC = A * A + B * B - 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);
        double result = Math.sqrt(dC);
        System.out.print(result);

    }

}