X = int(input()) Y = int(input()) if (X + 4) % 12 == Y: Z = (X + 8) % 12 else: Z = (X + 4) % 12 print(Z)