A, B = map(int, input().split()) ans = 10**5 for a in range(0, A+1): if A-a > B: continue natural = a + B - (A-a) unnatural = A-a + A - a ans = min(ans, abs(natural-unnatural)) print(ans)