x,k,d=map(int,input().split())
x=abs(x)
i=min(x//d,k) if (k-x//d)%2==0 else min(x//d+1,k)
print(abs(x-d*i)) 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 i=min(x//d,k) if (k-x//d)%2==0 else min(x//d+1,k) i min(x//d,k) if (k-x//d)%2==0 else min(x//d+1,k) (k-x//d)%2==0 (k-x//d)%2 k-x//d k x//d x d 2 0 min(x//d,k) min x//d x d k min(x//d+1,k) min x//d+1 x//d x d 1 k print(abs(x-d*i)) print abs(x-d*i) abs x-d*i x d*i d i 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 i=min(x//d,k) if (k-x//d)%2==0 else min(x//d+1,k) min(x//d,k) if (k-x//d)%2==0 else min(x//d+1,k) i x=abs(x) abs(x) x
x,k,d=map(int,input().split())
x=abs(x)
i=min(x//d,k) if (k-x//d)%2==0 else min(x//d+1,k)
print(abs(x-d*i))