X, Y = list(map(int, input().split())) if (X + 4) % 12 == Y: Z = (Y + 4) % 12 else: Z = (X + 4) % 12 print(Z)