import sys
x,k,d=map(int,input().split())

x=abs(x)

a=x//d

if a>=k:
    ans=x-k*d

elif (k-a)%2==0:
    ans=x-d*a

else:
    ans=x-d*a-d

print(abs(ans)) import sys sys x,k,d=map(int,input().split()) x map(int,input().split()) map int input().split() ().split () input split k d x=abs(x) x abs(x) abs x a=x//d a x//d x d if a>=k:
    ans=x-k*d

elif (k-a)%2==0:
    ans=x-d*a

else:
    ans=x-d*a-d a>=k a k ans=x-k*d ans x-k*d x k*d k d elif (k-a)%2==0:
    ans=x-d*a (k-a)%2==0 (k-a)%2 k-a k a 2 0 ans=x-d*a ans x-d*a x d*a d a ans=x-d*a-d ans x-d*a-d x-d*a x d*a d a d print(abs(ans)) print abs(ans) abs ans x=abs(x) abs(x) x ans=x-d*a x-d*a ans k,d=map(int,input().split()) map(int,input().split()) k a=x//d x//d a d=map(int,input().split()) map(int,input().split()) d ans=x-k*d x-k*d ans ans=x-d*a-d x-d*a-d ans x,k,d=map(int,input().split()) map(int,input().split()) x
import sys
x,k,d=map(int,input().split())

x=abs(x)

a=x//d

if a>=k:
    ans=x-k*d

elif (k-a)%2==0:
    ans=x-d*a

else:
    ans=x-d*a-d

print(abs(ans))