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

if x < 0:
    x = -x

if k <= x/d:
    an = x-d*k
else:
    if (k-x//d)%2==0:
        an = x-d*(x//d)
    else:
        an = x-d*(x//d)-d
        
print(abs(an)) x,k,d = map(int,input().split()) x map(int,input().split()) map int input().split() ().split () input split k d an = x an x if x < 0:
    x = -x x < 0 x 0 x = -x x -x x if k <= x/d:
    an = x-d*k
else:
    if (k-x//d)%2==0:
        an = x-d*(x//d)
    else:
        an = x-d*(x//d)-d
         k <= x/d k x/d x d an = x-d*k an x-d*k x d*k d k if (k-x//d)%2==0:
        an = x-d*(x//d)
    else:
        an = x-d*(x//d)-d
         (k-x//d)%2==0 (k-x//d)%2 k-x//d k x//d x d 2 0 an = x-d*(x//d) an x-d*(x//d) x d*(x//d) d x//d x d an = x-d*(x//d)-d an x-d*(x//d)-d x-d*(x//d) x d*(x//d) d x//d x d d print(abs(an)) print abs(an) abs an an = x-d*k x-d*k an an = x-d*(x//d)-d x-d*(x//d)-d an x = -x -x x an = x-d*(x//d) x-d*(x//d) an x,k,d = map(int,input().split()) map(int,input().split()) x an = x x an d = map(int,input().split()) map(int,input().split()) d k,d = map(int,input().split()) map(int,input().split()) k
x,k,d = map(int,input().split())
an = x

if x < 0:
    x = -x

if k <= x/d:
    an = x-d*k
else:
    if (k-x//d)%2==0:
        an = x-d*(x//d)
    else:
        an = x-d*(x//d)-d
        
print(abs(an))