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