#!/usr/bin/env python3
# input
X, K, D = map(int, input().split())
DIV = (X + K * D) // (2 * D)

if X + K * D < 0:
    ans = -(X + K * D)
elif X - K * D > 0:
    ans = X - K * D
else:
    ans = min(X + K * D - DIV * D * 2, -(X + K * D - (1 + DIV) * D * 2))
print(ans) X, K, D = map(int, input().split()) X map(int, input().split()) map int input().split() ().split () input split K D DIV = (X + K * D) // (2 * D) DIV (X + K * D) // (2 * D) X + K * D X K * D K D 2 * D 2 D if X + K * D < 0:
    ans = -(X + K * D)
elif X - K * D > 0:
    ans = X - K * D
else:
    ans = min(X + K * D - DIV * D * 2, -(X + K * D - (1 + DIV) * D * 2)) X + K * D < 0 X + K * D X K * D K D 0 ans = -(X + K * D) ans -(X + K * D) X + K * D X K * D K D elif X - K * D > 0:
    ans = X - K * D X - K * D > 0 X - K * D X K * D K D 0 ans = X - K * D ans X - K * D X K * D K D ans = min(X + K * D - DIV * D * 2, -(X + K * D - (1 + DIV) * D * 2)) ans min(X + K * D - DIV * D * 2, -(X + K * D - (1 + DIV) * D * 2)) min X + K * D - DIV * D * 2 X + K * D X K * D K D DIV * D * 2 DIV * D DIV D 2 -(X + K * D - (1 + DIV) * D * 2) X + K * D - (1 + DIV) * D * 2 X + K * D X K * D K D (1 + DIV) * D * 2 (1 + DIV) * D 1 + DIV 1 DIV D 2 print(ans) print ans ans = -(X + K * D) -(X + K * D) ans ans = min(X + K * D - DIV * D * 2, -(X + K * D - (1 + DIV) * D * 2)) min(X + K * D - DIV * D * 2, -(X + K * D - (1 + DIV) * D * 2)) ans ans = X - K * D X - K * D ans DIV = (X + K * D) // (2 * D) (X + K * D) // (2 * D) DIV D = map(int, input().split()) map(int, input().split()) D X, K, D = map(int, input().split()) map(int, input().split()) X K, D = map(int, input().split()) map(int, input().split()) K
#!/usr/bin/env python3
# input
X, K, D = map(int, input().split())
DIV = (X + K * D) // (2 * D)

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