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