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

X = abs(X)

if X//D > K:
    print(X-(D*K))
    exit()

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

X = abs(X)

if X//D > K:
    print(X-(D*K))
    exit()

if (K-X//D)%2:
    print(D-X%D)
else:
    print(X%D)