/*
3cm 4cm 9時 0分
*/

function main(input){
	input = input.trim();
	var list = input.split(" ");
	var jHari = parseInt(list[0]);
	var fHari = parseInt(list[1]);
	var ji = parseInt(list[2]);
	var fun = parseInt(list[3]);
	console.log([jHari,fHari,ji,fun]);

	function deg(deg){
		return(deg*Math.PI/180);
	}
	var posJ = [Math.cos(deg(ji*30))*jHari, Math.sin(deg(ji*30))*jHari];
	var posF = [Math.cos(deg(fun*6))*fHari, Math.sin(deg(fun*6))*fHari];
	function kyori(ax,ay,bx,by){
		return(Math.sqrt((ax-bx)**2+(ay-by)**2));
	}
	console.log(kyori(posJ[0],posJ[1],posF[0],posF[1]));
}
main(require("fs").readFileSync("/dev/stdin","utf8"));
