X,K,D = map(int,input().split())
if K*D<=abs(X):
    print(abs(X)-K*D)
elif (K-(abs(X)//D))%2==0:
    print(abs(X)%D)
elif (K-(abs(X)//D))%2==1:
    print(-(abs(X)%D-D)) X,K,D = map(int,input().split()) X map(int,input().split()) map int input().split() ().split () input split K D if K*D<=abs(X):
    print(abs(X)-K*D)
elif (K-(abs(X)//D))%2==0:
    print(abs(X)%D)
elif (K-(abs(X)//D))%2==1:
    print(-(abs(X)%D-D)) K*D<=abs(X) K*D K D abs(X) abs X print(abs(X)-K*D) print abs(X)-K*D abs(X) abs X K*D K D elif (K-(abs(X)//D))%2==0:
    print(abs(X)%D) (K-(abs(X)//D))%2==0 (K-(abs(X)//D))%2 K-(abs(X)//D) K abs(X)//D abs(X) abs X D 2 0 print(abs(X)%D) print abs(X)%D abs(X) abs X D elif (K-(abs(X)//D))%2==1:
    print(-(abs(X)%D-D)) (K-(abs(X)//D))%2==1 (K-(abs(X)//D))%2 K-(abs(X)//D) K abs(X)//D abs(X) abs X D 2 1 print(-(abs(X)%D-D)) print -(abs(X)%D-D) abs(X)%D-D abs(X)%D abs(X) abs X D D D = map(int,input().split()) map(int,input().split()) D X,K,D = map(int,input().split()) map(int,input().split()) X K,D = map(int,input().split()) map(int,input().split()) K
X,K,D = map(int,input().split())
if K*D<=abs(X):
    print(abs(X)-K*D)
elif (K-(abs(X)//D))%2==0:
    print(abs(X)%D)
elif (K-(abs(X)//D))%2==1:
    print(-(abs(X)%D-D))