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

X = abs(X)

cuts = X//D

if cuts>=K:
    print(X-(K*D))
else:
    remainingcuts = K-cuts
    r = X-cuts*D

    if remainingcuts%2 == 1:
        print(abs(r-D))
    else:
        print(r) 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 cuts = X//D cuts X//D X D if cuts>=K:
    print(X-(K*D))
else:
    remainingcuts = K-cuts
    r = X-cuts*D

    if remainingcuts%2 == 1:
        print(abs(r-D))
    else:
        print(r) cuts>=K cuts K print(X-(K*D)) print X-(K*D) X K*D K D remainingcuts = K-cuts remainingcuts K-cuts K cuts r = X-cuts*D r X-cuts*D X cuts*D cuts D if remainingcuts%2 == 1:
        print(abs(r-D))
    else:
        print(r) remainingcuts%2 == 1 remainingcuts%2 remainingcuts 2 1 print(abs(r-D)) print abs(r-D) abs r-D r D print(r) print r K, D = map(int, input().split()) map(int, input().split()) K X = abs(X) abs(X) X cuts = X//D X//D cuts r = X-cuts*D X-cuts*D r X, K, D = map(int, input().split()) map(int, input().split()) X D = map(int, input().split()) map(int, input().split()) D remainingcuts = K-cuts K-cuts remainingcuts
X, K, D = map(int, input().split())

X = abs(X)

cuts = X//D

if cuts>=K:
    print(X-(K*D))
else:
    remainingcuts = K-cuts
    r = X-cuts*D

    if remainingcuts%2 == 1:
        print(abs(r-D))
    else:
        print(r)
