a,b=map(int,input().split()) x=(a+4)%12;y=(a+8)%12 print(y if x==b else x)