import java.math.BigDecimal;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);


        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int h = scanner.nextInt();
        int m = scanner.nextInt();
        BigDecimal hourY =new BigDecimal(a * Math.sin(Math.toRadians((double)((60 * h) + m) * 0.5)));
        BigDecimal hourX = new BigDecimal(a * Math.cos(Math.toRadians((double)((60 * h) + m) * 0.5)));
        BigDecimal minuteY = new BigDecimal(b * Math.sin(Math.toRadians(6 * m)));
        BigDecimal minuteX = new BigDecimal(b * Math.cos(Math.toRadians(6 * m)));
        BigDecimal x = hourX.subtract(minuteX);
        BigDecimal y = hourY.subtract(minuteY);
        BigDecimal xx = x.multiply(x);
        BigDecimal yy = y.multiply(y);
        BigDecimal preResult = xx.add(yy);
        System.out.println(Math.sqrt(preResult.doubleValue()));



    }
}

/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz