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

N = X // D
if K < abs(N):
    ans = abs(abs(X) - K * D)
else:
    if (K - abs(N)) % 2 == 0:
        ans = abs(X - N * D)
    else:
        ans = abs(X - (N+1) * D)

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

N = X // D
if K < abs(N):
    ans = abs(abs(X) - K * D)
else:
    if (K - abs(N)) % 2 == 0:
        ans = abs(X - N * D)
    else:
        ans = abs(X - (N+1) * D)

print(ans)
