A=io.read"*n"
B=io.read"*n"
H=io.read"*n"
M=io.read"*n"

Ax=A*math.sin((H/12+M/60/12)*math.pi*2)
Ay=A*math.cos((H/12+M/60/12)*math.pi*2)
Bx=B*math.sin(M/60*math.pi*2)
By=B*math.cos(M/60*math.pi*2)

print(math.sqrt((Ax-Bx)^2+(Ay-By)^2))