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

# k回　dだけ変化

n=abs(x)//d
if k>=n:
  k=k-n
else:
  n=k
  k=0
  
if k%2 == 0:
  x=abs(x)-d*n
else:
  x=abs(x)-d*(n+1)

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

# k回　dだけ変化

n=abs(x)//d
if k>=n:
  k=k-n
else:
  n=k
  k=0
  
if k%2 == 0:
  x=abs(x)-d*n
else:
  x=abs(x)-d*(n+1)

print(abs(x))