local function flag(x)return x>0 and 1 or x<0 and -1 or 0 end
X=io.read"*n"
K=io.read"*n"
D=io.read"*n"
 
K1=K-math.floor(math.abs(X)/D)
if(K1<0)then print(math.abs(X)-D*K)return end
X=X-flag(X)*D*(K-K1)
print(K1%2==0 and math.abs(X) or D-math.abs(X))