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

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

X = abs(X)
if X % D == 0:
    tmp = X // D
    if tmp >= K:
        print(X - D * K)
    else:
        tmp = K - tmp
        if tmp % 2 == 0:
            print(0)
        else:
            print(D)
else:
    tmp = X // D
    if tmp >= K:
        print(X - D * K)
    else:
        tmp = K - tmp
        if tmp % 2 == 0:
            print(X - X // D * D)
        else:
            print(abs(X - (X // D + 1) * D))