X, K, D = map(int, input().split())
absX = abs(X)
step = min(K, (absX // D))

if K > step:
  extra = - D * ((K - step) % 2)
else:
  extra = 0

print(abs(absX - step * D + extra)) X, K, D = map(int, input().split()) X map(int, input().split()) map int input().split() ().split () input split K D absX = abs(X) absX abs(X) abs X step = min(K, (absX // D)) step min(K, (absX // D)) min K absX // D absX D if K > step:
  extra = - D * ((K - step) % 2)
else:
  extra = 0 K > step K step extra = - D * ((K - step) % 2) extra - D * ((K - step) % 2) - D D (K - step) % 2 K - step K step 2 extra = 0 extra 0 print(abs(absX - step * D + extra)) print abs(absX - step * D + extra) abs absX - step * D + extra absX - step * D absX step * D step D extra D = map(int, input().split()) map(int, input().split()) D extra = - D * ((K - step) % 2) - D * ((K - step) % 2) extra extra = 0 0 extra absX = abs(X) abs(X) absX X, K, D = map(int, input().split()) map(int, input().split()) X K, D = map(int, input().split()) map(int, input().split()) K step = min(K, (absX // D)) min(K, (absX // D)) step
X, K, D = map(int, input().split())
absX = abs(X)
step = min(K, (absX // D))

if K > step:
  extra = - D * ((K - step) % 2)
else:
  extra = 0

print(abs(absX - step * D + extra))