a, b = map(int, input().split()) ans = 100000 x = min(a, b) y = max(a, b) for i in range(x+1): m = max(y-i, i) n = min(y-i, i) for j in range(n, m+1): ans = min(ans, abs(2*(i+j)-(x+y))) print(ans)