x, k, d = map(int,input().split())
x =abs(x)
s = x//d
if x-k*d>0:
  print(x-k*d)
else:
    if (k-s)%2==0:
        print(x-s*d)
    else:
        print(-x+(s+1)*d) 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 s = x//d s x//d x d if x-k*d>0:
  print(x-k*d)
else:
    if (k-s)%2==0:
        print(x-s*d)
    else:
        print(-x+(s+1)*d) x-k*d>0 x-k*d x k*d k d 0 print(x-k*d) print x-k*d x k*d k d if (k-s)%2==0:
        print(x-s*d)
    else:
        print(-x+(s+1)*d) (k-s)%2==0 (k-s)%2 k-s k s 2 0 print(x-s*d) print x-s*d x s*d s d print(-x+(s+1)*d) print -x+(s+1)*d -x x (s+1)*d s+1 s 1 d k, d = map(int,input().split()) map(int,input().split()) k s = x//d x//d s x, k, d = map(int,input().split()) map(int,input().split()) x d = map(int,input().split()) map(int,input().split()) d x =abs(x) abs(x) x
x, k, d = map(int,input().split())
x =abs(x)
s = x//d
if x-k*d>0:
  print(x-k*d)
else:
    if (k-s)%2==0:
        print(x-s*d)
    else:
        print(-x+(s+1)*d)
