import java.io.*;
import java.util.*;
import java.lang.*;
import java.text.DecimalFormat;
public class Main {
public static void main (String[]args) {

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    try {
        DecimalFormat df = new DecimalFormat("0.000000000");
        String  lines = br.readLine();    

        String[] strs = lines.trim().split("\\s+");
         int [] a = new int [4];
        for (int i = 0; i < strs.length; i++) {
        a[i] = Integer.parseInt(strs[i]);
        }

    // Cosine Law solve 

  double radian = Math.PI * 2 * ((double)a[2] / 12.0 + ((double)a[3] / 60.0) / 12.0 - (double)a[3]/ 60.0);
    
  double ans = (double)(a[0] * a[0]+ a[1] * a[1]) - (double)(2 * a[0] *
  a[1]) * Math.cos(radian);
  System.out.println(df.format(Math.sqrt(ans)));

    }catch (Exception e) {
       }
       }
   } import java.io.*; io.* java import java.util.*; util.* java import java.lang.*; lang.* java import java.text.DecimalFormat; DecimalFormat java.text public class Main {
public static void main (String[]args) {

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    try {
        DecimalFormat df = new DecimalFormat("0.000000000");
        String  lines = br.readLine();    

        String[] strs = lines.trim().split("\\s+");
         int [] a = new int [4];
        for (int i = 0; i < strs.length; i++) {
        a[i] = Integer.parseInt(strs[i]);
        }

    // Cosine Law solve 

  double radian = Math.PI * 2 * ((double)a[2] / 12.0 + ((double)a[3] / 60.0) / 12.0 - (double)a[3]/ 60.0);
    
  double ans = (double)(a[0] * a[0]+ a[1] * a[1]) - (double)(2 * a[0] *
  a[1]) * Math.cos(radian);
  System.out.println(df.format(Math.sqrt(ans)));

    }catch (Exception e) {
       }
       }
   } Main public static void main (String[]args) {

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    try {
        DecimalFormat df = new DecimalFormat("0.000000000");
        String  lines = br.readLine();    

        String[] strs = lines.trim().split("\\s+");
         int [] a = new int [4];
        for (int i = 0; i < strs.length; i++) {
        a[i] = Integer.parseInt(strs[i]);
        }

    // Cosine Law solve 

  double radian = Math.PI * 2 * ((double)a[2] / 12.0 + ((double)a[3] / 60.0) / 12.0 - (double)a[3]/ 60.0);
    
  double ans = (double)(a[0] * a[0]+ a[1] * a[1]) - (double)(2 * a[0] *
  a[1]) * Math.cos(radian);
  System.out.println(df.format(Math.sqrt(ans)));

    }catch (Exception e) {
       }
       } main {

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    try {
        DecimalFormat df = new DecimalFormat("0.000000000");
        String  lines = br.readLine();    

        String[] strs = lines.trim().split("\\s+");
         int [] a = new int [4];
        for (int i = 0; i < strs.length; i++) {
        a[i] = Integer.parseInt(strs[i]);
        }

    // Cosine Law solve 

  double radian = Math.PI * 2 * ((double)a[2] / 12.0 + ((double)a[3] / 60.0) / 12.0 - (double)a[3]/ 60.0);
    
  double ans = (double)(a[0] * a[0]+ a[1] * a[1]) - (double)(2 * a[0] *
  a[1]) * Math.cos(radian);
  System.out.println(df.format(Math.sqrt(ans)));

    }catch (Exception e) {
       }
       } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) try {
        DecimalFormat df = new DecimalFormat("0.000000000");
        String  lines = br.readLine();    

        String[] strs = lines.trim().split("\\s+");
         int [] a = new int [4];
        for (int i = 0; i < strs.length; i++) {
        a[i] = Integer.parseInt(strs[i]);
        }

    // Cosine Law solve 

  double radian = Math.PI * 2 * ((double)a[2] / 12.0 + ((double)a[3] / 60.0) / 12.0 - (double)a[3]/ 60.0);
    
  double ans = (double)(a[0] * a[0]+ a[1] * a[1]) - (double)(2 * a[0] *
  a[1]) * Math.cos(radian);
  System.out.println(df.format(Math.sqrt(ans)));

    }catch (Exception e) {
       } catch (Exception e) {
       } Exception e {
       } {
        DecimalFormat df = new DecimalFormat("0.000000000");
        String  lines = br.readLine();    

        String[] strs = lines.trim().split("\\s+");
         int [] a = new int [4];
        for (int i = 0; i < strs.length; i++) {
        a[i] = Integer.parseInt(strs[i]);
        }

    // Cosine Law solve 

  double radian = Math.PI * 2 * ((double)a[2] / 12.0 + ((double)a[3] / 60.0) / 12.0 - (double)a[3]/ 60.0);
    
  double ans = (double)(a[0] * a[0]+ a[1] * a[1]) - (double)(2 * a[0] *
  a[1]) * Math.cos(radian);
  System.out.println(df.format(Math.sqrt(ans)));

    } DecimalFormat df = new DecimalFormat("0.000000000"); df new DecimalFormat("0.000000000") String  lines = br.readLine(); lines br.readLine() br.readLine br String[] strs = lines.trim().split("\\s+"); strs lines.trim().split("\\s+") lines.trim().split lines.trim() lines.trim lines "\\s+" int [] a = new int [4]; a new int [4] 4 for (int i = 0; i < strs.length; i++) {
        a[i] = Integer.parseInt(strs[i]);
        } int i = 0; int i = 0; i 0 i < strs.length i strs.length strs strs.length i++ i++ i {
        a[i] = Integer.parseInt(strs[i]);
        } {
        a[i] = Integer.parseInt(strs[i]);
        } a[i] = Integer.parseInt(strs[i]) a[i] a i Integer.parseInt(strs[i]) Integer.parseInt Integer strs[i] strs i double radian = Math.PI * 2 * ((double)a[2] / 12.0 + ((double)a[3] / 60.0) / 12.0 - (double)a[3]/ 60.0); radian Math.PI * 2 * ((double)a[2] / 12.0 + ((double)a[3] / 60.0) / 12.0 - (double)a[3]/ 60.0) Math.PI * 2 * ((double)a[2] / 12.0 + ((double)a[3] / 60.0) / 12.0 - (double)a[3]/ 60.0) Math.PI Math Math.PI 2 ((double)a[2] / 12.0 + ((double)a[3] / 60.0) / 12.0 - (double)a[3]/ 60.0) (double)a[2] / 12.0 + ((double)a[3] / 60.0) / 12.0 (double)a[2] / 12.0 (double)a[2] a 2 12.0 ((double)a[3] / 60.0) / 12.0 ((double)a[3] / 60.0) (double)a[3] a 3 60.0 12.0 (double)a[3]/ 60.0 (double)a[3] a 3 60.0 double ans = (double)(a[0] * a[0]+ a[1] * a[1]) - (double)(2 * a[0] *
  a[1]) * Math.cos(radian); ans (double)(a[0] * a[0]+ a[1] * a[1]) - (double)(2 * a[0] *
  a[1]) * Math.cos(radian) (double)(a[0] * a[0]+ a[1] * a[1]) a[0] * a[0] a[0] a 0 a[0] a 0 a[1] * a[1] a[1] a 1 a[1] a 1 (double)(2 * a[0] *
  a[1]) * Math.cos(radian) (double)(2 * a[0] *
  a[1]) 2 * a[0] *
  a[1] 2 a[0] a 0 a[1] a 1 Math.cos(radian) Math.cos Math radian System.out.println(df.format(Math.sqrt(ans))) System.out.println System.out System System.out df.format(Math.sqrt(ans)) df.format df Math.sqrt(ans) Math.sqrt Math ans String[]args args public class Main {
public static void main (String[]args) {

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    try {
        DecimalFormat df = new DecimalFormat("0.000000000");
        String  lines = br.readLine();    

        String[] strs = lines.trim().split("\\s+");
         int [] a = new int [4];
        for (int i = 0; i < strs.length; i++) {
        a[i] = Integer.parseInt(strs[i]);
        }

    // Cosine Law solve 

  double radian = Math.PI * 2 * ((double)a[2] / 12.0 + ((double)a[3] / 60.0) / 12.0 - (double)a[3]/ 60.0);
    
  double ans = (double)(a[0] * a[0]+ a[1] * a[1]) - (double)(2 * a[0] *
  a[1]) * Math.cos(radian);
  System.out.println(df.format(Math.sqrt(ans)));

    }catch (Exception e) {
       }
       }
   } public class Main {
public static void main (String[]args) {

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    try {
        DecimalFormat df = new DecimalFormat("0.000000000");
        String  lines = br.readLine();    

        String[] strs = lines.trim().split("\\s+");
         int [] a = new int [4];
        for (int i = 0; i < strs.length; i++) {
        a[i] = Integer.parseInt(strs[i]);
        }

    // Cosine Law solve 

  double radian = Math.PI * 2 * ((double)a[2] / 12.0 + ((double)a[3] / 60.0) / 12.0 - (double)a[3]/ 60.0);
    
  double ans = (double)(a[0] * a[0]+ a[1] * a[1]) - (double)(2 * a[0] *
  a[1]) * Math.cos(radian);
  System.out.println(df.format(Math.sqrt(ans)));

    }catch (Exception e) {
       }
       }
   } Main
import java.io.*;
import java.util.*;
import java.lang.*;
import java.text.DecimalFormat;
public class Main {
public static void main (String[]args) {

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    try {
        DecimalFormat df = new DecimalFormat("0.000000000");
        String  lines = br.readLine();    

        String[] strs = lines.trim().split("\\s+");
         int [] a = new int [4];
        for (int i = 0; i < strs.length; i++) {
        a[i] = Integer.parseInt(strs[i]);
        }

    // Cosine Law solve 

  double radian = Math.PI * 2 * ((double)a[2] / 12.0 + ((double)a[3] / 60.0) / 12.0 - (double)a[3]/ 60.0);
    
  double ans = (double)(a[0] * a[0]+ a[1] * a[1]) - (double)(2 * a[0] *
  a[1]) * Math.cos(radian);
  System.out.println(df.format(Math.sqrt(ans)));

    }catch (Exception e) {
       }
       }
   }