import sys input = sys.stdin.readline X,Y=map(int,input().split()) if (X+4)%12==Y: print((X+8)%12) else: print((X+4)%12)