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