X,K,D = map(int,input().split())
dist = abs(X)
rem = K
count = min(dist//D,K)
dist -= count*D
rem -= count
if rem % 2 == 1:
  dist -= D
print(abs(dist))  X,K,D = map(int,input().split()) X map(int,input().split()) map int input().split() ().split () input split K D dist = abs(X) dist abs(X) abs X rem = K rem K count = min(dist//D,K) count min(dist//D,K) min dist//D dist D K dist -= count*D dist count*D count D rem -= count rem count if rem % 2 == 1:
  dist -= D rem % 2 == 1 rem % 2 rem 2 1 dist -= D dist D print(abs(dist)) print abs(dist) abs dist K,D = map(int,input().split()) map(int,input().split()) K rem -= count count rem rem = K K rem count = min(dist//D,K) min(dist//D,K) count X,K,D = map(int,input().split()) map(int,input().split()) X dist -= D D dist dist = abs(X) abs(X) dist dist -= count*D count*D dist D = map(int,input().split()) map(int,input().split()) D
X,K,D = map(int,input().split())
dist = abs(X)
rem = K
count = min(dist//D,K)
dist -= count*D
rem -= count
if rem % 2 == 1:
  dist -= D
print(abs(dist)) 
