X, K, D = map(int, input().split())

value = abs(X)

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

value = abs(X)

if (value / D) >= K:
  print(value - D * K)
else:
  min_count = value // D
  mod_value = K - min_count
  if mod_value % 2 == 0:
    print(value % D)
  else:
    print(abs(value % D - D))