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

if X<0:
    X=-X

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

if X<0:
    X=-X

if K*D<X:
    print(X-K*D)
else:
    k = K - int(X/D)
    x = X % D
    if k%2:
        print(abs(x-D))
    else:
        print(x)
