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