a, b = map(int, input().split()) rad_a = a % 12 * 30 + b / 2 rad_b = b * 6 rad_d = rad_a - rad_b if rad_d < 0: rad_d += 360 diff = 1 / 10 - 30 / (60 * 60) print(int(rad_d / diff + 10e-5))