def calculate_night_hours(s1, e1): overlap = 0.0 # Check overlap with 0-6 hours start = max(s1, 0.0) end = min(e1, 6.0) if start < end: overlap += end - start # Check overlap with 18-24 hours start = max(s1, 18.0) end = min(e1, 24.0) if start < end: overlap += end - start return overlap T, S, D = map(int, input().split()) travel_time = D / S days = int(travel_time // 24) remainder = travel_time % 24 total_night = days * 12 start = T end = start + remainder if end > 24: # Split into two intervals part1_start = start part1_end = 24.0 part2_start = 0.0 part2_end = end - 24.0 overlap1 = calculate_night_hours(part1_start, part1_end) overlap2 = calculate_night_hours(part2_start, part2_end) total_remainder = overlap1 + overlap2 else: total_remainder = calculate_night_hours(start, end) total_night += total_remainder print("{0:.15f}".format(total_night))