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