import sys input = sys.stdin.readline from collections import * A, B = map(int, input().split()) ans = 10**18 for i in range(A+1): if B-A+i>=0: nat = B-A+2*i odd = 2*(A-i) ans = min(ans, abs(nat-odd)) print(ans)