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

X = abs(X)
count = X // D

if count >= K:
    answer = X - K*D
else:
    if (K - count) % 2 == 0:
        answer = X - count*D
    else:
        answer = abs(X - (count+1)*D)

print(answer) X, K, D = list(map(int, input().split())) X list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split K D X = abs(X) X abs(X) abs X count = X // D count X // D X D if count >= K:
    answer = X - K*D
else:
    if (K - count) % 2 == 0:
        answer = X - count*D
    else:
        answer = abs(X - (count+1)*D) count >= K count K answer = X - K*D answer X - K*D X K*D K D if (K - count) % 2 == 0:
        answer = X - count*D
    else:
        answer = abs(X - (count+1)*D) (K - count) % 2 == 0 (K - count) % 2 K - count K count 2 0 answer = X - count*D answer X - count*D X count*D count D answer = abs(X - (count+1)*D) answer abs(X - (count+1)*D) abs X - (count+1)*D X (count+1)*D count+1 count 1 D print(answer) print answer X, K, D = list(map(int, input().split())) list(map(int, input().split())) X K, D = list(map(int, input().split())) list(map(int, input().split())) K count = X // D X // D count X = abs(X) abs(X) X answer = X - count*D X - count*D answer answer = abs(X - (count+1)*D) abs(X - (count+1)*D) answer D = list(map(int, input().split())) list(map(int, input().split())) D answer = X - K*D X - K*D answer
X, K, D = list(map(int, input().split()))

X = abs(X)
count = X // D

if count >= K:
    answer = X - K*D
else:
    if (K - count) % 2 == 0:
        answer = X - count*D
    else:
        answer = abs(X - (count+1)*D)

print(answer)