X, K, D = [int(v) for v in input().split()]

X = abs(X)
m = X // D
p = K - m if m <= K else 0

if p == 0:
    print(X - (K*D))
else:
    X -= m * D
    if p & 1:
        print(abs(X-D))
    else:
        print(X) int(v) for v in input().split() for v in input().split() v input().split() ().split () input split for v in input().split() int(v) int v X, K, D = [int(v) for v in input().split()] X [int(v) for v in input().split()] K D X = abs(X) X abs(X) abs X m = X // D m X // D X D p = K - m if m <= K else 0 p K - m if m <= K else 0 m <= K m K K - m K m 0 if p == 0:
    print(X - (K*D))
else:
    X -= m * D
    if p & 1:
        print(abs(X-D))
    else:
        print(X) p == 0 p 0 print(X - (K*D)) print X - (K*D) X K*D K D X -= m * D X m * D m D if p & 1:
        print(abs(X-D))
    else:
        print(X) p & 1 p 1 print(abs(X-D)) print abs(X-D) abs X-D X D print(X) print X D = [int(v) for v in input().split()] [int(v) for v in input().split()] D X, K, D = [int(v) for v in input().split()] [int(v) for v in input().split()] X K, D = [int(v) for v in input().split()] [int(v) for v in input().split()] K X = abs(X) abs(X) X m = X // D X // D m p = K - m if m <= K else 0 K - m if m <= K else 0 p X -= m * D m * D X
X, K, D = [int(v) for v in input().split()]

X = abs(X)
m = X // D
p = K - m if m <= K else 0

if p == 0:
    print(X - (K*D))
else:
    X -= m * D
    if p & 1:
        print(abs(X-D))
    else:
        print(X)