X, K, D = list(map(int, input().split()))
X = abs(X)
if(X >= K * D):
  print(X - K * D)
else:
  q = X // D
  r = X % D
  if((K - q) % 2 == 0):
    print(r)
  else:
    print(abs(r - D)) X, K, D = list(map(int, input().split())) X list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split K D X = abs(X) X abs(X) abs X if(X >= K * D):
  print(X - K * D)
else:
  q = X // D
  r = X % D
  if((K - q) % 2 == 0):
    print(r)
  else:
    print(abs(r - D)) X >= K * D X K * D K D print(X - K * D) print X - K * D X K * D K D q = X // D q X // D X D r = X % D r X % D X D if((K - q) % 2 == 0):
    print(r)
  else:
    print(abs(r - D)) (K - q) % 2 == 0 (K - q) % 2 K - q K q 2 0 print(r) print r print(abs(r - D)) print abs(r - D) abs r - D r D q = X // D X // D q X, K, D = list(map(int, input().split())) list(map(int, input().split())) X X = abs(X) abs(X) X D = list(map(int, input().split())) list(map(int, input().split())) D r = X % D X % D r K, D = list(map(int, input().split())) list(map(int, input().split())) K
X, K, D = list(map(int, input().split()))
X = abs(X)
if(X >= K * D):
  print(X - K * D)
else:
  q = X // D
  r = X % D
  if((K - q) % 2 == 0):
    print(r)
  else:
    print(abs(r - D))
