t, s, d = map(int, input().split()) if 0 <= t <= 6: t += 24 drive = d / s ans = (drive - (30 - t)) // 24 if ans >= 1: print(30 - t + 12 * ans) else: if drive > 12: print(30 - t) else: print(drive)