X,K,D = map(int,input().split())
A = abs(X)
ans = 0
if A >= D*K:
    print( A - (D * K))
else :
    e = A//D
    K -= e
    A %= D
    if K%2 == 0:
        print(A)
    else:
        print(D-A) X,K,D = map(int,input().split()) X map(int,input().split()) map int input().split() ().split () input split K D A = abs(X) A abs(X) abs X ans = 0 ans 0 if A >= D*K:
    print( A - (D * K))
else :
    e = A//D
    K -= e
    A %= D
    if K%2 == 0:
        print(A)
    else:
        print(D-A) A >= D*K A D*K D K print( A - (D * K)) print A - (D * K) A D * K D K e = A//D e A//D A D K -= e K e A %= D A D if K%2 == 0:
        print(A)
    else:
        print(D-A) K%2 == 0 K%2 K 2 0 print(A) print A print(D-A) print D-A D A D = map(int,input().split()) map(int,input().split()) D A %= D D A K,D = map(int,input().split()) map(int,input().split()) K X,K,D = map(int,input().split()) map(int,input().split()) X A = abs(X) abs(X) A ans = 0 0 ans e = A//D A//D e K -= e e K
X,K,D = map(int,input().split())
A = abs(X)
ans = 0
if A >= D*K:
    print( A - (D * K))
else :
    e = A//D
    K -= e
    A %= D
    if K%2 == 0:
        print(A)
    else:
        print(D-A)