let input = require('fs').readFileSync('/dev/stdin', 'utf8').split(' ');


const a = parseInt(input[0],10);
const b = parseInt(input[1],10);
const h = parseInt(input[2],10);
const m = parseInt(input[3],10);
const pi = 3.14159265358979;

const arga = (h + m/60)*pi/6;
const argb = pi * m / 30;
console.log(h+m/60,arga,argb);

const c = (a**2 + b**2 - 2*a*b*Math.cos(arga-argb))**0.5;

console.log(c);