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

t = X // D
if abs(t) >= K:
  if X > 0:
  	print(abs(X-(D*K)))
  elif X < 0:
    print(abs(X+(D*K)))
  exit(0)

nokori = K - t
if X-(D*t) <= 0:
  if nokori % 2 == 0:
  	print(abs(X-(D*t)))
  else:
    print(abs(X-(D*(t-1))))
else:
  if nokori % 2 == 0:
  	print(abs(X-(D*t)))
  else:
    print(abs(X-(D*(t+1)))) X, K, D = map(int, input().split()) X map(int, input().split()) map int input().split() ().split () input split K D t = X // D t X // D X D if abs(t) >= K:
  if X > 0:
  	print(abs(X-(D*K)))
  elif X < 0:
    print(abs(X+(D*K)))
  exit(0) abs(t) >= K abs(t) abs t K if X > 0:
  	print(abs(X-(D*K)))
  elif X < 0:
    print(abs(X+(D*K)))
   X > 0 X 0 print(abs(X-(D*K))) print abs(X-(D*K)) abs X-(D*K) X D*K D K elif X < 0:
    print(abs(X+(D*K)))
   X < 0 X 0 print(abs(X+(D*K))) print abs(X+(D*K)) abs X+(D*K) X D*K D K exit(0) exit 0 nokori = K - t nokori K - t K t if X-(D*t) <= 0:
  if nokori % 2 == 0:
  	print(abs(X-(D*t)))
  else:
    print(abs(X-(D*(t-1))))
else:
  if nokori % 2 == 0:
  	print(abs(X-(D*t)))
  else:
    print(abs(X-(D*(t+1)))) X-(D*t) <= 0 X-(D*t) X D*t D t 0 if nokori % 2 == 0:
  	print(abs(X-(D*t)))
  else:
    print(abs(X-(D*(t-1)))) nokori % 2 == 0 nokori % 2 nokori 2 0 print(abs(X-(D*t))) print abs(X-(D*t)) abs X-(D*t) X D*t D t print(abs(X-(D*(t-1)))) print abs(X-(D*(t-1))) abs X-(D*(t-1)) X D*(t-1) D t-1 t 1 if nokori % 2 == 0:
  	print(abs(X-(D*t)))
  else:
    print(abs(X-(D*(t+1)))) nokori % 2 == 0 nokori % 2 nokori 2 0 print(abs(X-(D*t))) print abs(X-(D*t)) abs X-(D*t) X D*t D t print(abs(X-(D*(t+1)))) print abs(X-(D*(t+1))) abs X-(D*(t+1)) X D*(t+1) D t+1 t 1 nokori = K - t K - t nokori D = map(int, input().split()) map(int, input().split()) D X, K, D = map(int, input().split()) map(int, input().split()) X t = X // D X // D t K, D = map(int, input().split()) map(int, input().split()) K
X, K, D = map(int, input().split())

t = X // D
if abs(t) >= K:
  if X > 0:
  	print(abs(X-(D*K)))
  elif X < 0:
    print(abs(X+(D*K)))
  exit(0)

nokori = K - t
if X-(D*t) <= 0:
  if nokori % 2 == 0:
  	print(abs(X-(D*t)))
  else:
    print(abs(X-(D*(t-1))))
else:
  if nokori % 2 == 0:
  	print(abs(X-(D*t)))
  else:
    print(abs(X-(D*(t+1))))
