import math
X, K, D = map(int, input().split())
ans = 0
if K * D < abs(X):
    ans = abs(X) - K * D
elif (K - math.floor(abs(X) / D)) % 2 == 0:
    ans = abs(X) - (math.floor(abs(X) / D)) * D
else:
    ans = abs(X) - (math.floor(abs(X) / D)) * D - D

print(abs(int(ans))) import math math X, K, D = map(int, input().split()) X map(int, input().split()) map int input().split() ().split () input split K D ans = 0 ans 0 if K * D < abs(X):
    ans = abs(X) - K * D
elif (K - math.floor(abs(X) / D)) % 2 == 0:
    ans = abs(X) - (math.floor(abs(X) / D)) * D
else:
    ans = abs(X) - (math.floor(abs(X) / D)) * D - D K * D < abs(X) K * D K D abs(X) abs X ans = abs(X) - K * D ans abs(X) - K * D abs(X) abs X K * D K D elif (K - math.floor(abs(X) / D)) % 2 == 0:
    ans = abs(X) - (math.floor(abs(X) / D)) * D (K - math.floor(abs(X) / D)) % 2 == 0 (K - math.floor(abs(X) / D)) % 2 K - math.floor(abs(X) / D) K math.floor(abs(X) / D) math.floor math floor abs(X) / D abs(X) abs X D 2 0 ans = abs(X) - (math.floor(abs(X) / D)) * D ans abs(X) - (math.floor(abs(X) / D)) * D abs(X) abs X (math.floor(abs(X) / D)) * D math.floor(abs(X) / D) math.floor math floor abs(X) / D abs(X) abs X D D ans = abs(X) - (math.floor(abs(X) / D)) * D - D ans abs(X) - (math.floor(abs(X) / D)) * D - D abs(X) - (math.floor(abs(X) / D)) * D abs(X) abs X (math.floor(abs(X) / D)) * D math.floor(abs(X) / D) math.floor math floor abs(X) / D abs(X) abs X D D D print(abs(int(ans))) print abs(int(ans)) abs int(ans) int ans K, D = map(int, input().split()) map(int, input().split()) K ans = abs(X) - K * D abs(X) - K * D ans X, K, D = map(int, input().split()) map(int, input().split()) X D = map(int, input().split()) map(int, input().split()) D ans = abs(X) - (math.floor(abs(X) / D)) * D abs(X) - (math.floor(abs(X) / D)) * D ans ans = 0 0 ans ans = abs(X) - (math.floor(abs(X) / D)) * D - D abs(X) - (math.floor(abs(X) / D)) * D - D ans
import math
X, K, D = map(int, input().split())
ans = 0
if K * D < abs(X):
    ans = abs(X) - K * D
elif (K - math.floor(abs(X) / D)) % 2 == 0:
    ans = abs(X) - (math.floor(abs(X) / D)) * D
else:
    ans = abs(X) - (math.floor(abs(X) / D)) * D - D

print(abs(int(ans)))
