X, Y = map(int, input().split()) if X > Y: X, Y = Y, X if Y - X == 8: print(X + 4) else: print((Y + 4) % 12)