x,y = map(int,input().split()) m = min(x,y) M = max(x,y) if (M+4)%12 == m: ans = m+4 else: ans = (M+4)%12 print(ans)