def main(): a,b = map(int,input().split()) n = a+b unnatural = abs(a-b) natural = n - unnatural mn = abs(natural - unnatural) for i in range(min(a,b)): unnatural += 2 natural -= 2 mn = min(mn,abs(natural - unnatural)) print(mn) if __name__ == '__main__': main()