import std;
enum inf(T)()if(__traits(isArithmetic,T)){return T.max/4;}
T scan(T=long)(){return readln.chomp.to!T;}
void scan(T...)(ref T args){auto input=readln.chomp.split;foreach(i,t;T)args[i]=input[i].to!t;}
T[] scanarr(T=long)(){return readln.chomp.split.to!(T[]);}
//END OF TEMPLATE

void main(){
    real a,b,h,m;
    scan(a,b,h,m);
    real ang=h*30+m*0.5-m*6;
    ang.writeln;
    dis(a,b,ang).writeln;
}

real dis(real a,real b,real ang){
    ang.writeln;
    (ang*PI/180).writeln;
    (sin(ang*PI/180.0)).writeln;
    return sqrt((a-cos(ang*PI/180.0)*b)^^2+(sin(ang*PI/180.0)*b)^^2);
}

