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

dgree_h = H / 12. * 360.
dgree_m = M / 60. * 360.

ang = math.pi / 180. * abs(dgree_h - dgree_m)
print(ang)


a = '{:.21f}'.format(math.sqrt(A ** 2. + B ** 2. - 2. * A * B * math.cos(ang)))
print((a))