x,k,d=map(int,input().split())
cur=abs(x)
count=min(cur//d,k)
cur-=d*count
k-=count
if k%2==1:
  cur-=d
print(abs(cur)) x,k,d=map(int,input().split()) x map(int,input().split()) map int input().split() ().split () input split k d cur=abs(x) cur abs(x) abs x count=min(cur//d,k) count min(cur//d,k) min cur//d cur d k cur-=d*count cur d*count d count k-=count k count if k%2==1:
  cur-=d k%2==1 k%2 k 2 1 cur-=d cur d print(abs(cur)) print abs(cur) abs cur k-=count count k count=min(cur//d,k) min(cur//d,k) count cur-=d d cur cur=abs(x) abs(x) cur x,k,d=map(int,input().split()) map(int,input().split()) x k,d=map(int,input().split()) map(int,input().split()) k d=map(int,input().split()) map(int,input().split()) d cur-=d*count d*count cur
x,k,d=map(int,input().split())
cur=abs(x)
count=min(cur//d,k)
cur-=d*count
k-=count
if k%2==1:
  cur-=d
print(abs(cur))
