X, Y = map(int, input().split()) Z = (X+4)%12 if Y==Z: Z = (Y+4)%12 print(Z)