X, K, D = map(int, input().split())
X = abs(X)
q = X // D
r = X % D
ans = 0
if q >= K:
    print(X - D * K)
    exit()
rem = K - q
if rem % 2 == 0:
    ans = r
else:
    ans = D - r
print(ans)

9d050800619ad0c2d333ca9125d69199389d4492
<mask token>

<mask token>
if q >= K:
    print(X - D * K)
    exit()
<mask token>
if rem % 2 == 0:
    ans = r
else:
    ans = D - r
print(ans)

X, K, D = map(int, input().split())
X = abs(X)
q = X // D
r = X % D
ans = 0
if q >= K:
    print(X - D * K)
    exit()
rem = K - q
if rem % 2 == 0:
    ans = r
else:
    ans = D - r
print(ans)
