# author:  Taichicchi
# created: 15.09.2020 21:22:26

import sys

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

X = abs(X)

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

    if k % 2:
        print(abs(x - D))
    else:
        print(x) import sys sys 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:
    print(X - (K * D))
else:
    k = K - X // D
    x = X - D * (X // D)

    if k % 2:
        print(abs(x - D))
    else:
        print(x) X >= K * D X K * D K D print(X - (K * D)) print X - (K * D) X K * D K D k = K - X // D k K - X // D K X // D X D x = X - D * (X // D) x X - D * (X // D) X D * (X // D) D X // D X D if k % 2:
        print(abs(x - D))
    else:
        print(x) k % 2 k 2 print(abs(x - D)) print abs(x - D) abs x - D x D print(x) print x 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 = X - D * (X // D) X - D * (X // D) x D = map(int, input().split()) map(int, input().split()) D k = K - X // D K - X // D k
# author:  Taichicchi
# created: 15.09.2020 21:22:26

import sys

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

X = abs(X)

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

    if k % 2:
        print(abs(x - D))
    else:
        print(x)
