# 175 C
X, K, D = list(map(int, input().split()))
div = abs(X)//D
mod = abs(X)%D
if abs(X) > K*D:
    print(abs(X) - K*D)
elif (K-div)%2 == 0:
    print(mod)
else:
    print(D-mod) 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 div = abs(X)//D div abs(X)//D abs(X) abs X D mod = abs(X)%D mod abs(X)%D abs(X) abs X D if abs(X) > K*D:
    print(abs(X) - K*D)
elif (K-div)%2 == 0:
    print(mod)
else:
    print(D-mod) abs(X) > K*D abs(X) abs X K*D K D print(abs(X) - K*D) print abs(X) - K*D abs(X) abs X K*D K D elif (K-div)%2 == 0:
    print(mod) (K-div)%2 == 0 (K-div)%2 K-div K div 2 0 print(mod) print mod print(D-mod) print D-mod D mod div = abs(X)//D abs(X)//D div K, D = list(map(int, input().split())) list(map(int, input().split())) K mod = abs(X)%D abs(X)%D mod X, K, D = list(map(int, input().split())) list(map(int, input().split())) X D = list(map(int, input().split())) list(map(int, input().split())) D
# 175 C
X, K, D = list(map(int, input().split()))
div = abs(X)//D
mod = abs(X)%D
if abs(X) > K*D:
    print(abs(X) - K*D)
elif (K-div)%2 == 0:
    print(mod)
else:
    print(D-mod)