X, K, D = map(int, input().split())
X = abs(X)
if X - K*D >= 0:
    print(X - K*D)
else:
    M = X // D
    K -= M
    X -= M*D

    if K % 2:
        X -= D
    print(abs(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 - K*D >= 0:
    print(X - K*D)
else:
    M = X // D
    K -= M
    X -= M*D

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

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