import sys readline=sys.stdin.readline X,Y=map(int,readline().split()) ans=(X+X-Y)%12 print(ans)