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

count = abs(x)//d

if x<0:
    before_border = x+d*count
    after_border = x+d*(count+1)
else:
    before_border = x-d*count
    after_border = x-d*(count+1)
    
if count >= k:
    if x<0:
        print(abs(x+d*k))
    else:
        print(abs(x-d*k))
else:
    if (count-k)%2 == 0:
        print(abs(before_border))
    else:
        print(abs(after_border)) x,k,d = map(int,input().split()) x map(int,input().split()) map int input().split() ().split () input split k d count = abs(x)//d count abs(x)//d abs(x) abs x d if x<0:
    before_border = x+d*count
    after_border = x+d*(count+1)
else:
    before_border = x-d*count
    after_border = x-d*(count+1)
     x<0 x 0 before_border = x+d*count before_border x+d*count x d*count d count after_border = x+d*(count+1) after_border x+d*(count+1) x d*(count+1) d count+1 count 1 before_border = x-d*count before_border x-d*count x d*count d count after_border = x-d*(count+1) after_border x-d*(count+1) x d*(count+1) d count+1 count 1 if count >= k:
    if x<0:
        print(abs(x+d*k))
    else:
        print(abs(x-d*k))
else:
    if (count-k)%2 == 0:
        print(abs(before_border))
    else:
        print(abs(after_border)) count >= k count k if x<0:
        print(abs(x+d*k))
    else:
        print(abs(x-d*k)) x<0 x 0 print(abs(x+d*k)) print abs(x+d*k) abs x+d*k x d*k d k print(abs(x-d*k)) print abs(x-d*k) abs x-d*k x d*k d k if (count-k)%2 == 0:
        print(abs(before_border))
    else:
        print(abs(after_border)) (count-k)%2 == 0 (count-k)%2 count-k count k 2 0 print(abs(before_border)) print abs(before_border) abs before_border print(abs(after_border)) print abs(after_border) abs after_border count = abs(x)//d abs(x)//d count after_border = x+d*(count+1) x+d*(count+1) after_border after_border = x-d*(count+1) x-d*(count+1) after_border x,k,d = map(int,input().split()) map(int,input().split()) x before_border = x+d*count x+d*count before_border k,d = map(int,input().split()) map(int,input().split()) k d = map(int,input().split()) map(int,input().split()) d before_border = x-d*count x-d*count before_border
x,k,d = map(int,input().split())

count = abs(x)//d

if x<0:
    before_border = x+d*count
    after_border = x+d*(count+1)
else:
    before_border = x-d*count
    after_border = x-d*(count+1)
    
if count >= k:
    if x<0:
        print(abs(x+d*k))
    else:
        print(abs(x-d*k))
else:
    if (count-k)%2 == 0:
        print(abs(before_border))
    else:
        print(abs(after_border))