import java.util.Scanner;

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();
  
  		double kakudoTansin = 30 * H + 0.5 * M;
  		double kakudoTyousin = 6 * M;
  		double kakudo = Math.abs(kakudoTansin - kakudoTyousin);
  		if(kakudo > 180){
        		kakudo = 360-kakudo;
        }
  		double cnizyou = A * A + B * B - 2 * A * B * Math.cos(kakudo*(Math.PI/180));
        double c = Math.sqrt(cnizyou);
  		System.out.println(c);
	}
} import java.util.Scanner; Scanner java.util 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();
  
  		double kakudoTansin = 30 * H + 0.5 * M;
  		double kakudoTyousin = 6 * M;
  		double kakudo = Math.abs(kakudoTansin - kakudoTyousin);
  		if(kakudo > 180){
        		kakudo = 360-kakudo;
        }
  		double cnizyou = A * A + B * B - 2 * A * B * Math.cos(kakudo*(Math.PI/180));
        double c = Math.sqrt(cnizyou);
  		System.out.println(c);
	}
} 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();
  
  		double kakudoTansin = 30 * H + 0.5 * M;
  		double kakudoTyousin = 6 * M;
  		double kakudo = Math.abs(kakudoTansin - kakudoTyousin);
  		if(kakudo > 180){
        		kakudo = 360-kakudo;
        }
  		double cnizyou = A * A + B * B - 2 * A * B * Math.cos(kakudo*(Math.PI/180));
        double c = Math.sqrt(cnizyou);
  		System.out.println(c);
	} main {
		Scanner sc = new Scanner(System.in);
  		int A = sc.nextInt();
  		int B = sc.nextInt();
  		int H = sc.nextInt();
  		int M = sc.nextInt();
  
  		double kakudoTansin = 30 * H + 0.5 * M;
  		double kakudoTyousin = 6 * M;
  		double kakudo = Math.abs(kakudoTansin - kakudoTyousin);
  		if(kakudo > 180){
        		kakudo = 360-kakudo;
        }
  		double cnizyou = A * A + B * B - 2 * A * B * Math.cos(kakudo*(Math.PI/180));
        double c = Math.sqrt(cnizyou);
  		System.out.println(c);
	} 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 double kakudoTansin = 30 * H + 0.5 * M; kakudoTansin 30 * H + 0.5 * M 30 * H 30 H 0.5 * M 0.5 M double kakudoTyousin = 6 * M; kakudoTyousin 6 * M 6 M double kakudo = Math.abs(kakudoTansin - kakudoTyousin); kakudo Math.abs(kakudoTansin - kakudoTyousin) Math.abs Math kakudoTansin - kakudoTyousin kakudoTansin kakudoTyousin if(kakudo > 180){
        		kakudo = 360-kakudo;
        } kakudo > 180 kakudo 180 {
        		kakudo = 360-kakudo;
        } kakudo = 360-kakudo kakudo 360-kakudo 360 kakudo double cnizyou = A * A + B * B - 2 * A * B * Math.cos(kakudo*(Math.PI/180)); cnizyou A * A + B * B - 2 * A * B * Math.cos(kakudo*(Math.PI/180)) A * A + B * B A * A A A B * B B B 2 * A * B * Math.cos(kakudo*(Math.PI/180)) B 2 * A * B * Math.cos(kakudo*(Math.PI/180)) 2 A B Math.cos(kakudo*(Math.PI/180)) Math.cos Math kakudo*(Math.PI/180) kakudo (Math.PI/180) Math.PI Math Math.PI 180 double c = Math.sqrt(cnizyou); c Math.sqrt(cnizyou) Math.sqrt Math cnizyou System.out.println(c) System.out.println System.out System System.out c String[] args args
import java.util.Scanner;

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();
  
  		double kakudoTansin = 30 * H + 0.5 * M;
  		double kakudoTyousin = 6 * M;
  		double kakudo = Math.abs(kakudoTansin - kakudoTyousin);
  		if(kakudo > 180){
        		kakudo = 360-kakudo;
        }
  		double cnizyou = A * A + B * B - 2 * A * B * Math.cos(kakudo*(Math.PI/180));
        double c = Math.sqrt(cnizyou);
  		System.out.println(c);
	}
}