X, K, D = map(int, input().split())
X = abs(X)
cnt = X // D
if cnt >= K:
  print(X - D * K)
  exit()
if (K - cnt) % 2 == 0:
  print(X - D * cnt)
else:
  print(abs(X - D * cnt - 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 cnt = X // D cnt X // D X D if cnt >= K:
  print(X - D * K)
  exit() cnt >= K cnt K print(X - D * K) print X - D * K X D * K D K exit() exit if (K - cnt) % 2 == 0:
  print(X - D * cnt)
else:
  print(abs(X - D * cnt - D)) (K - cnt) % 2 == 0 (K - cnt) % 2 K - cnt K cnt 2 0 print(X - D * cnt) print X - D * cnt X D * cnt D cnt print(abs(X - D * cnt - D)) print abs(X - D * cnt - D) abs X - D * cnt - D X - D * cnt X D * cnt D cnt D X, K, D = map(int, input().split()) map(int, input().split()) X K, D = map(int, input().split()) map(int, input().split()) K D = map(int, input().split()) map(int, input().split()) D cnt = X // D X // D cnt X = abs(X) abs(X) X
X, K, D = map(int, input().split())
X = abs(X)
cnt = X // D
if cnt >= K:
  print(X - D * K)
  exit()
if (K - cnt) % 2 == 0:
  print(X - D * cnt)
else:
  print(abs(X - D * cnt - D))