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