A,B=map(int,input().split()) a=200 for i in range(max(A-B,0),A+1):a=min(a,abs(A+B-(i*2+B-A)*2)) print(a)