X, Y = map(int, input().split()) d = (Y - X) % 12 Z = (Y + d) % 12 print(Z)