X,K,D=map(int,input().split())

import math

X=abs(X)
U=min(math.floor(X/D),K)
K=K-U
A=X-U*D

if K%2==0:
    print(A)
else:
    print(abs(A-D)) X,K,D=map(int,input().split()) X map(int,input().split()) map int input().split() ().split () input split K D import math math X=abs(X) X abs(X) abs X U=min(math.floor(X/D),K) U min(math.floor(X/D),K) min math.floor(X/D) math.floor math floor X/D X D K K=K-U K K-U K U A=X-U*D A X-U*D X U*D U D if K%2==0:
    print(A)
else:
    print(abs(A-D)) K%2==0 K%2 K 2 0 print(A) print A print(abs(A-D)) print abs(A-D) abs A-D A D X,K,D=map(int,input().split()) map(int,input().split()) X D=map(int,input().split()) map(int,input().split()) D K=K-U K-U K U=min(math.floor(X/D),K) min(math.floor(X/D),K) U A=X-U*D X-U*D A X=abs(X) abs(X) X K,D=map(int,input().split()) map(int,input().split()) K
X,K,D=map(int,input().split())

import math

X=abs(X)
U=min(math.floor(X/D),K)
K=K-U
A=X-U*D

if K%2==0:
    print(A)
else:
    print(abs(A-D))