A, B = map(int,input().split())
R = 200
for i in range(max(A - B, 0), A + 1):
  R = min(R, abs(A + B - (i * 2 + B - A) * 2))
print(R)