X, K, D = map(int, input().split())

if X - K * D >= 0:
    ans = abs(X - K * D)
elif X + K * D <= 0:
    ans = abs(X + K * D)
else:
    n = int(abs(X - K * D) / (2 * D))
    ans = min(abs(X - K * D + n * 2 * D), abs(X - K * D + (n + 1) * 2 * D))
    
print(ans) X, K, D = map(int, input().split()) X map(int, input().split()) map int input().split() ().split () input split K D if X - K * D >= 0:
    ans = abs(X - K * D)
elif X + K * D <= 0:
    ans = abs(X + K * D)
else:
    n = int(abs(X - K * D) / (2 * D))
    ans = min(abs(X - K * D + n * 2 * D), abs(X - K * D + (n + 1) * 2 * D))
     X - K * D >= 0 X - K * D X K * D K D 0 ans = abs(X - K * D) ans abs(X - K * D) abs X - K * D X K * D K D elif X + K * D <= 0:
    ans = abs(X + K * D) X + K * D <= 0 X + K * D X K * D K D 0 ans = abs(X + K * D) ans abs(X + K * D) abs X + K * D X K * D K D n = int(abs(X - K * D) / (2 * D)) n int(abs(X - K * D) / (2 * D)) int abs(X - K * D) / (2 * D) abs(X - K * D) abs X - K * D X K * D K D 2 * D 2 D ans = min(abs(X - K * D + n * 2 * D), abs(X - K * D + (n + 1) * 2 * D)) ans min(abs(X - K * D + n * 2 * D), abs(X - K * D + (n + 1) * 2 * D)) min abs(X - K * D + n * 2 * D) abs X - K * D + n * 2 * D X - K * D X K * D K D n * 2 * D n * 2 n 2 D abs(X - K * D + (n + 1) * 2 * D) abs X - K * D + (n + 1) * 2 * D X - K * D X K * D K D (n + 1) * 2 * D (n + 1) * 2 n + 1 n 1 2 D print(ans) print ans X, K, D = map(int, input().split()) map(int, input().split()) X K, D = map(int, input().split()) map(int, input().split()) K D = map(int, input().split()) map(int, input().split()) D ans = abs(X - K * D) abs(X - K * D) ans ans = abs(X + K * D) abs(X + K * D) ans n = int(abs(X - K * D) / (2 * D)) int(abs(X - K * D) / (2 * D)) n ans = min(abs(X - K * D + n * 2 * D), abs(X - K * D + (n + 1) * 2 * D)) min(abs(X - K * D + n * 2 * D), abs(X - K * D + (n + 1) * 2 * D)) ans
X, K, D = map(int, input().split())

if X - K * D >= 0:
    ans = abs(X - K * D)
elif X + K * D <= 0:
    ans = abs(X + K * D)
else:
    n = int(abs(X - K * D) / (2 * D))
    ans = min(abs(X - K * D + n * 2 * D), abs(X - K * D + (n + 1) * 2 * D))
    
print(ans)