function Main(input) {
	var str = input;
	var ans = 0;
	var str = str.split("\n")[0];
	var num = str.split(" ");
	var a = Number(num[0]);	
	var b = Number(num[1]);	
	var h = Number(num[2]);
	var m = Number(num[3]);
	
	var dega = 0.5*(m+60*h);
	var degb = 6*m;
	var rada = dega * (Math.PI / 180);
	var radb = degb * (Math.PI / 180);
	
	var ax = a*Math.sin(rada);
	var ay = a*Math.cos(rada);
	var bx = b*Math.sin(radb);
	var by = b*Math.cos(radb);
	
	ans = Math.sqrt((ax-bx)*(ax-bx)+ (ay-by)*(ay-by));
	ans = Math.round(ans*(10**10))/(10**10);
	console.log(ans);
	}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));