import math
# 時針の速度
# 360度/720分 = 1/2度/m
# 分針の速度
# 360度/60分 = 6度/m
# 時針と分針の度数は両者を減算したものの絶対値
# 使用するのは余弦定理

# def str_to_int(str_num):
#     int_num = int(str_num)
#     return int_num


line = input().split(' ')
# int_line = list(map(lambda str_num: int(str_num), line))
int_line = [int(str_num) for str_num in line]
print(int_line)

# 時針の進行角度
# radian_h =　(H * 60 + M) * 0.5
# radian_m = M * 6

# 時針と分針の角度
degree = abs((int_line[2] * 60 + int_line[3]) * 0.5 - int_line[3] * 6)

# 分針と時針の末端同士の距離
distance_squared = int_line[0] ** 2 + int_line[1] ** 2 - 2 * \
    int_line[0] * int_line[1] * math.cos(math.radians(degree))

distance = math.sqrt(distance_squared)

# print(distance)
