import math
X,K,D=map(int,input().split())
count=0
#Xが初期値
#Dが移動量（+or-）
#K回移動後の最小の座標
#X/D＞Kの場合、K*D＋Xが答え

Y = 0
#X>0 D>0 の場合
if X / D > K and X / D > 0:
    Y = abs(X - D * K)
elif abs(X / D) > K and X / D < 0:
    Y = abs(X + D * K)
else:
    #X/D<Kの場合、X mod D
    L = abs(X) % D
    M = math.floor(abs(X) / D)
    if (K - M) % 2 == 0:
        Y = L
    else:
        Y=abs(L-D)

print(Y) import math math X,K,D=map(int,input().split()) X map(int,input().split()) map int input().split() ().split () input split K D count=0 count 0 Y = 0 Y 0 if X / D > K and X / D > 0:
    Y = abs(X - D * K)
elif abs(X / D) > K and X / D < 0:
    Y = abs(X + D * K)
else:
    #X/D<Kの場合、X mod D
    L = abs(X) % D
    M = math.floor(abs(X) / D)
    if (K - M) % 2 == 0:
        Y = L
    else:
        Y=abs(L-D) X / D > K and X / D > 0 X / D > K X / D X D K X / D > 0 X / D X D 0 Y = abs(X - D * K) Y abs(X - D * K) abs X - D * K X D * K D K elif abs(X / D) > K and X / D < 0:
    Y = abs(X + D * K) abs(X / D) > K and X / D < 0 abs(X / D) > K abs(X / D) abs X / D X D K X / D < 0 X / D X D 0 Y = abs(X + D * K) Y abs(X + D * K) abs X + D * K X D * K D K L = abs(X) % D L abs(X) % D abs(X) abs X D M = math.floor(abs(X) / D) M math.floor(abs(X) / D) math.floor math floor abs(X) / D abs(X) abs X D if (K - M) % 2 == 0:
        Y = L
    else:
        Y=abs(L-D) (K - M) % 2 == 0 (K - M) % 2 K - M K M 2 0 Y = L Y L Y=abs(L-D) Y abs(L-D) abs L-D L D print(Y) print Y K,D=map(int,input().split()) map(int,input().split()) K Y = abs(X - D * K) abs(X - D * K) Y L = abs(X) % D abs(X) % D L Y = 0 0 Y Y = L L Y Y=abs(L-D) abs(L-D) Y D=map(int,input().split()) map(int,input().split()) D M = math.floor(abs(X) / D) math.floor(abs(X) / D) M X,K,D=map(int,input().split()) map(int,input().split()) X count=0 0 count Y = abs(X + D * K) abs(X + D * K) Y
import math
X,K,D=map(int,input().split())
count=0
#Xが初期値
#Dが移動量（+or-）
#K回移動後の最小の座標
#X/D＞Kの場合、K*D＋Xが答え

Y = 0
#X>0 D>0 の場合
if X / D > K and X / D > 0:
    Y = abs(X - D * K)
elif abs(X / D) > K and X / D < 0:
    Y = abs(X + D * K)
else:
    #X/D<Kの場合、X mod D
    L = abs(X) % D
    M = math.floor(abs(X) / D)
    if (K - M) % 2 == 0:
        Y = L
    else:
        Y=abs(L-D)

print(Y)