T, S, D = map(int, input().split()) t_total = D / S S_time = T E_time = T + t_total total_careful = 0.0 max_k = int((E_time - 18) // 24) + 2 # Adding 2 to ensure we cover all possible k for k in range(max_k + 1): night_start = 18 + 24 * k night_end = 30 + 24 * k # 6 + 24*(k+1) = 6 + 24k +24 = 30 +24k if E_time <= night_start: continue if S_time >= night_end: continue overlap_start = max(S_time, night_start) overlap_end = min(E_time, night_end) if overlap_start < overlap_end: total_careful += overlap_end - overlap_start print("{0:.15f}".format(total_careful))