import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String[] line = bufferedReader.readLine().split(" ");
        int A = Integer.parseInt(line[0]);
        int B = Integer.parseInt(line[1]);
        int H = Integer.parseInt(line[2]);
        int M = Integer.parseInt(line[3]);
        double radA = Math.PI * (60 * H + M) / (60 * 12) * 2;
        double radB = Math.PI * M / 60 * 2;
        double C = Math.sqrt(A * A + B * B - 2 * A * B * Math.cos(Math.abs(radA - radB)));
        System.out.println(C);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String[] line = bufferedReader.readLine().split(" ");
        int A = Integer.parseInt(line[0]);
        int B = Integer.parseInt(line[1]);
        int H = Integer.parseInt(line[2]);
        int M = Integer.parseInt(line[3]);
        double radA = Math.PI * (60 * H + M) / (60 * 12) * 2;
        double radB = Math.PI * M / 60 * 2;
        double C = Math.sqrt(A * A + B * B - 2 * A * B * Math.cos(Math.abs(radA - radB)));
        System.out.println(C);
    }
} Main public static void main(String[] args) throws Exception {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String[] line = bufferedReader.readLine().split(" ");
        int A = Integer.parseInt(line[0]);
        int B = Integer.parseInt(line[1]);
        int H = Integer.parseInt(line[2]);
        int M = Integer.parseInt(line[3]);
        double radA = Math.PI * (60 * H + M) / (60 * 12) * 2;
        double radB = Math.PI * M / 60 * 2;
        double C = Math.sqrt(A * A + B * B - 2 * A * B * Math.cos(Math.abs(radA - radB)));
        System.out.println(C);
    } main {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String[] line = bufferedReader.readLine().split(" ");
        int A = Integer.parseInt(line[0]);
        int B = Integer.parseInt(line[1]);
        int H = Integer.parseInt(line[2]);
        int M = Integer.parseInt(line[3]);
        double radA = Math.PI * (60 * H + M) / (60 * 12) * 2;
        double radB = Math.PI * M / 60 * 2;
        double C = Math.sqrt(A * A + B * B - 2 * A * B * Math.cos(Math.abs(radA - radB)));
        System.out.println(C);
    } BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in)); bufferedReader new BufferedReader(new InputStreamReader(System.in)) String[] line = bufferedReader.readLine().split(" "); line bufferedReader.readLine().split(" ") bufferedReader.readLine().split bufferedReader.readLine() bufferedReader.readLine bufferedReader " " int A = Integer.parseInt(line[0]); A Integer.parseInt(line[0]) Integer.parseInt Integer line[0] line 0 int B = Integer.parseInt(line[1]); B Integer.parseInt(line[1]) Integer.parseInt Integer line[1] line 1 int H = Integer.parseInt(line[2]); H Integer.parseInt(line[2]) Integer.parseInt Integer line[2] line 2 int M = Integer.parseInt(line[3]); M Integer.parseInt(line[3]) Integer.parseInt Integer line[3] line 3 double radA = Math.PI * (60 * H + M) / (60 * 12) * 2; radA Math.PI * (60 * H + M) / (60 * 12) * 2 Math.PI * (60 * H + M) / (60 * 12) Math.PI * (60 * H + M) Math.PI Math Math.PI (60 * H + M) 60 * H 60 H M (60 * 12) 60 12 2 double radB = Math.PI * M / 60 * 2; radB Math.PI * M / 60 * 2 Math.PI * M / 60 Math.PI * M Math.PI Math Math.PI M 60 2 double C = Math.sqrt(A * A + B * B - 2 * A * B * Math.cos(Math.abs(radA - radB))); C Math.sqrt(A * A + B * B - 2 * A * B * Math.cos(Math.abs(radA - radB))) Math.sqrt Math A * A + B * B - 2 * A * B * Math.cos(Math.abs(radA - radB)) A * A + B * B A * A A A B * B B B 2 * A * B * Math.cos(Math.abs(radA - radB)) B 2 * A * B * Math.cos(Math.abs(radA - radB)) 2 A B Math.cos(Math.abs(radA - radB)) Math.cos Math Math.abs(radA - radB) Math.abs Math radA - radB radA radB System.out.println(C) System.out.println System.out System System.out C String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String[] line = bufferedReader.readLine().split(" ");
        int A = Integer.parseInt(line[0]);
        int B = Integer.parseInt(line[1]);
        int H = Integer.parseInt(line[2]);
        int M = Integer.parseInt(line[3]);
        double radA = Math.PI * (60 * H + M) / (60 * 12) * 2;
        double radB = Math.PI * M / 60 * 2;
        double C = Math.sqrt(A * A + B * B - 2 * A * B * Math.cos(Math.abs(radA - radB)));
        System.out.println(C);
    }
} public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String[] line = bufferedReader.readLine().split(" ");
        int A = Integer.parseInt(line[0]);
        int B = Integer.parseInt(line[1]);
        int H = Integer.parseInt(line[2]);
        int M = Integer.parseInt(line[3]);
        double radA = Math.PI * (60 * H + M) / (60 * 12) * 2;
        double radB = Math.PI * M / 60 * 2;
        double C = Math.sqrt(A * A + B * B - 2 * A * B * Math.cos(Math.abs(radA - radB)));
        System.out.println(C);
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws Exception {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String[] line = bufferedReader.readLine().split(" ");
        int A = Integer.parseInt(line[0]);
        int B = Integer.parseInt(line[1]);
        int H = Integer.parseInt(line[2]);
        int M = Integer.parseInt(line[3]);
        double radA = Math.PI * (60 * H + M) / (60 * 12) * 2;
        double radB = Math.PI * M / 60 * 2;
        double C = Math.sqrt(A * A + B * B - 2 * A * B * Math.cos(Math.abs(radA - radB)));
        System.out.println(C);
    }
}
