function C168(_input) {
    var lines = _input.split("\n");
    var [a, b, H, M] = lines.shift().split(' ').map(v => v*1);
    var min = (H * 60 + M);

    const radA = (min*0.5)*(Math.PI/180);
    const radB = (M*6)*(Math.PI/180);

    var posA = {x: Math.cos(radA) * a, y: Math.sin(radA) * a};
    var posB = {x: Math.cos(radB)* b, y: Math.sin(radB) * b};
    const x = (posB.x - posA.x) * (posB.x - posA.x);
    const y = (posB.y - posA.y) * (posB.y - posA.y);

    console.log(Math.sqrt(x + y));
}
C168(require("fs").readFileSync("/dev/stdin", "utf8"));