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