X, Y = map(int, input().split()) for i in range(1, 3): if (X + i*4) % 12 == Y: pass else: print((X + 1*4) % 12)