X,Y=map(int,input().split()) hen=min(abs(X-Y),12-abs(X-Y)) if (X+hen)%12!=Y: print((X+hen)%12) else: print((Y+hen)%12)