A, B=map(int,input().split())
if (A+4)%12!=A and (A+4)%12!=B:
    print((A+4)%12)
elif (B+4)%12!=A and (B+4)%12!=B:
    print((B+4)%12)