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