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

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int H = sc.nextInt();
    int M = sc.nextInt();
    BigDecimal AA = new BigDecimal(A);
    BigDecimal BB = new BigDecimal(B);
    BigDecimal HH = new BigDecimal(H);
    BigDecimal MM = new BigDecimal(M);
    BigDecimal ans2;
    BigDecimal kaku;
    BigDecimal mkaku;
    BigDecimal hkaku;
    BigDecimal AA2;
    BigDecimal BB2;
    BigDecimal CC;
    BigDecimal DD;
    double dkaku;
    double dans2;
    mkaku = MM.multiply(BigDecimal.valueOf(6)); 
    hkaku = HH.multiply(BigDecimal.valueOf(30));
    hkaku = hkaku.add(BigDecimal.valueOf((double)M / 2));
    kaku = mkaku.subtract(hkaku);
    dkaku = Math.abs(Math.toRadians(kaku.doubleValue()));
    AA2 = AA.multiply(AA);
    BB2 = BB.multiply(BB);
    CC = AA2.add(BB2);
    DD = BigDecimal.valueOf(Math.cos(dkaku));
    DD = DD.multiply(BigDecimal.valueOf(2));
    DD = DD.multiply(AA);
    DD = DD.multiply(BB);
    ans2 = CC.subtract(DD); 
    dans2 = ans2.doubleValue();
    double ans = Math.sqrt(dans2);
    System.out.println(ans);
  }
}
/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