import math

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

X = abs(X)

if X//D > K:
    ans = X - D*K
    print(abs(ans))
elif (K-(X//D))%2 == 0:
    Y = X - (X//D)*D
    print(abs(Y))
else:
    Y = X - (X//D)*D
    print(abs(D-Y)) import math math 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 if X//D > K:
    ans = X - D*K
    print(abs(ans))
elif (K-(X//D))%2 == 0:
    Y = X - (X//D)*D
    print(abs(Y))
else:
    Y = X - (X//D)*D
    print(abs(D-Y)) X//D > K X//D X D K ans = X - D*K ans X - D*K X D*K D K print(abs(ans)) print abs(ans) abs ans elif (K-(X//D))%2 == 0:
    Y = X - (X//D)*D
    print(abs(Y)) (K-(X//D))%2 == 0 (K-(X//D))%2 K-(X//D) K X//D X D 2 0 Y = X - (X//D)*D Y X - (X//D)*D X (X//D)*D X//D X D D print(abs(Y)) print abs(Y) abs Y Y = X - (X//D)*D Y X - (X//D)*D X (X//D)*D X//D X D D print(abs(D-Y)) print abs(D-Y) abs D-Y D Y Y = X - (X//D)*D X - (X//D)*D Y Y = X - (X//D)*D X - (X//D)*D Y ans = X - D*K X - D*K ans K,D = map(int,input().split()) map(int,input().split()) K D = map(int,input().split()) map(int,input().split()) D X,K,D = map(int,input().split()) map(int,input().split()) X X = abs(X) abs(X) X
import math

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

X = abs(X)

if X//D > K:
    ans = X - D*K
    print(abs(ans))
elif (K-(X//D))%2 == 0:
    Y = X - (X//D)*D
    print(abs(Y))
else:
    Y = X - (X//D)*D
    print(abs(D-Y))
