x, y = map(int, input().split()) a = (x + 4) % 12 b = (x + 8) % 12 if a != y: print(a) else: print(b)