X, K, D = map(int,input().split())
if X < 0: X *= -1
n = X // D
if K <= n: print(X - K * D)
else:
  X -= n * D
  K -= n
  if K % 2 == 0: print(X)
  else: print(-X + D) X, K, D = map(int,input().split()) X map(int,input().split()) map int input().split() ().split () input split K D if X < 0: X *= -1 X < 0 X 0 n = X // D n X // D X D if K <= n: print(X - K * D)
else:
  X -= n * D
  K -= n
  if K % 2 == 0: print(X)
  else: print(-X + D) K <= n K n X -= n * D X n * D n D K -= n K n if K % 2 == 0: print(X)
  else: print(-X + D) K % 2 == 0 K % 2 K 2 0 D = map(int,input().split()) map(int,input().split()) D X -= n * D n * D X K, D = map(int,input().split()) map(int,input().split()) K X, K, D = map(int,input().split()) map(int,input().split()) X n = X // D X // D n K -= n n K
X, K, D = map(int,input().split())
if X < 0: X *= -1
n = X // D
if K <= n: print(X - K * D)
else:
  X -= n * D
  K -= n
  if K % 2 == 0: print(X)
  else: print(-X + D)