X,K,D = map(int,input().split())
X = abs(X)
a = int(X/D)
if a < K:
        K -= a
        X -= a*D

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

if K*D <= X:
    X -= K*D
else:
    K %= 2
    for i in range(K):
        if X > 0:
            X -= D
        else:
            X += D
print(abs(X))