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()));



    }
} import java.math.BigDecimal; BigDecimal java.math import java.util.*; util.* java 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()));



    }
} 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()));



    } main {
        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()));



    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int a = scanner.nextInt(); a scanner.nextInt() scanner.nextInt scanner int b = scanner.nextInt(); b scanner.nextInt() scanner.nextInt scanner int h = scanner.nextInt(); h scanner.nextInt() scanner.nextInt scanner int m = scanner.nextInt(); m scanner.nextInt() scanner.nextInt scanner BigDecimal hourY =new BigDecimal(a * Math.sin(Math.toRadians((double)((60 * h) + m) * 0.5))); 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))); 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))); minuteY new BigDecimal(b * Math.sin(Math.toRadians(6 * m))) BigDecimal minuteX = new BigDecimal(b * Math.cos(Math.toRadians(6 * m))); minuteX new BigDecimal(b * Math.cos(Math.toRadians(6 * m))) BigDecimal x = hourX.subtract(minuteX); x hourX.subtract(minuteX) hourX.subtract hourX minuteX BigDecimal y = hourY.subtract(minuteY); y hourY.subtract(minuteY) hourY.subtract hourY minuteY BigDecimal xx = x.multiply(x); xx x.multiply(x) x.multiply x x BigDecimal yy = y.multiply(y); yy y.multiply(y) y.multiply y y BigDecimal preResult = xx.add(yy); preResult xx.add(yy) xx.add xx yy System.out.println(Math.sqrt(preResult.doubleValue())) System.out.println System.out System System.out Math.sqrt(preResult.doubleValue()) Math.sqrt Math preResult.doubleValue() preResult.doubleValue preResult String[] args args 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()));



    }
} 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()));



    }
} Main
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()));



    }
}
