import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;


import static java.lang.System.in;

class Main {
    public static void main(String[] args)throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String[] lo =reader.readLine().split(" ");
        int A = Integer.parseInt(lo[0]);
        int B = Integer.parseInt(lo[1]);
        int H = Integer.parseInt(lo[2]);
        int M = Integer.parseInt(lo[3]);
        double angle = Math.abs((H+M/(double)60)*(Math.PI/(double)6) - M*(Math.PI/(double)30));
        double res = Math.sqrt((double)(A*A)+(double)(B*B)-2*A*B*Math.cos(angle));
        DecimalFormat dec = new DecimalFormat("#0.000000000");
         System.out.println(dec.format(res));
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.text.DecimalFormat; DecimalFormat java.text import static java.lang.System.in; import static java.lang.System.in; import static java.lang.System.in; class Main {
    public static void main(String[] args)throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String[] lo =reader.readLine().split(" ");
        int A = Integer.parseInt(lo[0]);
        int B = Integer.parseInt(lo[1]);
        int H = Integer.parseInt(lo[2]);
        int M = Integer.parseInt(lo[3]);
        double angle = Math.abs((H+M/(double)60)*(Math.PI/(double)6) - M*(Math.PI/(double)30));
        double res = Math.sqrt((double)(A*A)+(double)(B*B)-2*A*B*Math.cos(angle));
        DecimalFormat dec = new DecimalFormat("#0.000000000");
         System.out.println(dec.format(res));
    }
} Main public static void main(String[] args)throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String[] lo =reader.readLine().split(" ");
        int A = Integer.parseInt(lo[0]);
        int B = Integer.parseInt(lo[1]);
        int H = Integer.parseInt(lo[2]);
        int M = Integer.parseInt(lo[3]);
        double angle = Math.abs((H+M/(double)60)*(Math.PI/(double)6) - M*(Math.PI/(double)30));
        double res = Math.sqrt((double)(A*A)+(double)(B*B)-2*A*B*Math.cos(angle));
        DecimalFormat dec = new DecimalFormat("#0.000000000");
         System.out.println(dec.format(res));
    } main {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String[] lo =reader.readLine().split(" ");
        int A = Integer.parseInt(lo[0]);
        int B = Integer.parseInt(lo[1]);
        int H = Integer.parseInt(lo[2]);
        int M = Integer.parseInt(lo[3]);
        double angle = Math.abs((H+M/(double)60)*(Math.PI/(double)6) - M*(Math.PI/(double)30));
        double res = Math.sqrt((double)(A*A)+(double)(B*B)-2*A*B*Math.cos(angle));
        DecimalFormat dec = new DecimalFormat("#0.000000000");
         System.out.println(dec.format(res));
    } BufferedReader reader = new BufferedReader(new InputStreamReader(in)); reader new BufferedReader(new InputStreamReader(in)) String[] lo =reader.readLine().split(" "); lo reader.readLine().split(" ") reader.readLine().split reader.readLine() reader.readLine reader " " int A = Integer.parseInt(lo[0]); A Integer.parseInt(lo[0]) Integer.parseInt Integer lo[0] lo 0 int B = Integer.parseInt(lo[1]); B Integer.parseInt(lo[1]) Integer.parseInt Integer lo[1] lo 1 int H = Integer.parseInt(lo[2]); H Integer.parseInt(lo[2]) Integer.parseInt Integer lo[2] lo 2 int M = Integer.parseInt(lo[3]); M Integer.parseInt(lo[3]) Integer.parseInt Integer lo[3] lo 3 double angle = Math.abs((H+M/(double)60)*(Math.PI/(double)6) - M*(Math.PI/(double)30)); angle Math.abs((H+M/(double)60)*(Math.PI/(double)6) - M*(Math.PI/(double)30)) Math.abs Math (H+M/(double)60)*(Math.PI/(double)6) - M*(Math.PI/(double)30) (H+M/(double)60)*(Math.PI/(double)6) (H+M/(double)60) H M/(double)60 M (double)60 (Math.PI/(double)6) Math.PI Math Math.PI (double)6 M*(Math.PI/(double)30) M (Math.PI/(double)30) Math.PI Math Math.PI (double)30 double res = Math.sqrt((double)(A*A)+(double)(B*B)-2*A*B*Math.cos(angle)); res Math.sqrt((double)(A*A)+(double)(B*B)-2*A*B*Math.cos(angle)) Math.sqrt Math (double)(A*A)+(double)(B*B)-2*A*B*Math.cos(angle) (double)(A*A)+(double)(B*B) (double)(A*A) A A (double)(B*B) B B 2*A*B*Math.cos(angle) B 2*A*B*Math.cos(angle) 2 A B Math.cos(angle) Math.cos Math angle DecimalFormat dec = new DecimalFormat("#0.000000000"); dec new DecimalFormat("#0.000000000") System.out.println(dec.format(res)) System.out.println System.out System System.out dec.format(res) dec.format dec res String[] args args
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat;


import static java.lang.System.in;

class Main {
    public static void main(String[] args)throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(in));
        String[] lo =reader.readLine().split(" ");
        int A = Integer.parseInt(lo[0]);
        int B = Integer.parseInt(lo[1]);
        int H = Integer.parseInt(lo[2]);
        int M = Integer.parseInt(lo[3]);
        double angle = Math.abs((H+M/(double)60)*(Math.PI/(double)6) - M*(Math.PI/(double)30));
        double res = Math.sqrt((double)(A*A)+(double)(B*B)-2*A*B*Math.cos(angle));
        DecimalFormat dec = new DecimalFormat("#0.000000000");
         System.out.println(dec.format(res));
    }
}
