X,Y = map(int, input().split()) Z1 = (X + 4) % 12 Z2 = (X + 8) % 12 if Z1 != Y: print(Z1) else: print(Z2)