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

if X >= K*D:
  ans = X - K*D
else:
  k = X // D
  if (K - k) % 2 == 0:
    ans = X - k*D
  else:
    ans = abs(X-(k+1)*D)

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

if X >= K*D:
  ans = X - K*D
else:
  k = X // D
  if (K - k) % 2 == 0:
    ans = X - k*D
  else:
    ans = abs(X-(k+1)*D)

print(ans)
