a,b=map(int,input().split()) if a>0: b=-b else: b*=2 if (abs(b)%2==1 and a*b<0): a=-a elif (abs(b)%2==0 and a*b>0): a=-a print(a-b)