a, b = map(int, input().split()) match = min(a, b) * 2 nokori = a + b - match if nokori >= match: print(nokori - match) else: if (match - nokori) % 2 == 1: print(1) else: print(0)