import math
A, B, H, M = map(int, input().split())
pi = math.pi

ta = 30*H + 0.5*M
tb = 6*M

t = math.fabs( ta - tb )

if t > 180.0:
    t = 360.0 - t

print(t)

t = (t*pi)/180.0

ans = A*A + B*B - 2*A*B*math.cos(t)

print("{:.9f}".format(math.sqrt(ans)))





