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

X = abs(X)

if X // D >= K:
    print(X - D*K)
else:
    e = X // D
    K -= e
    X -= D*e

    if K % 2 == 1:
        X = abs(X-D)

    print(X) 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 - D*K)
else:
    e = X // D
    K -= e
    X -= D*e

    if K % 2 == 1:
        X = abs(X-D)

    print(X) X // D >= K X // D X D K print(X - D*K) print X - D*K X D*K D K e = X // D e X // D X D K -= e K e X -= D*e X D*e D e if K % 2 == 1:
        X = abs(X-D)

     K % 2 == 1 K % 2 K 2 1 X = abs(X-D) X abs(X-D) abs X-D X D print(X) print X D = map(int, input().split()) map(int, input().split()) D X = abs(X-D) abs(X-D) X e = X // D X // D e X -= D*e D*e X K -= e e K K, D = map(int, input().split()) map(int, input().split()) K X = abs(X) abs(X) X X, K, D = map(int, input().split()) map(int, input().split()) X
X, K, D = map(int, input().split())

X = abs(X)

if X // D >= K:
    print(X - D*K)
else:
    e = X // D
    K -= e
    X -= D*e

    if K % 2 == 1:
        X = abs(X-D)

    print(X)
