a, b = map(int, input().split()) res = 1000 for c in range(a+b+1): d = a+b-c if c <= min(a, b)*2: res = min(res, abs(c-d)) print(res)