x, k, d = map(int, input().split())
x = abs(x)
l = x // d

if k <= l:
    print(abs(x - k * d))
else:
    print(abs(abs(x - d * l) - d * ((k - l) % 2))) x, k, d = map(int, input().split()) x map(int, input().split()) map int input().split() ().split () input split k d x = abs(x) x abs(x) abs x l = x // d l x // d x d if k <= l:
    print(abs(x - k * d))
else:
    print(abs(abs(x - d * l) - d * ((k - l) % 2))) k <= l k l print(abs(x - k * d)) print abs(x - k * d) abs x - k * d x k * d k d print(abs(abs(x - d * l) - d * ((k - l) % 2))) print abs(abs(x - d * l) - d * ((k - l) % 2)) abs abs(x - d * l) - d * ((k - l) % 2) abs(x - d * l) abs x - d * l x d * l d l d * ((k - l) % 2) d (k - l) % 2 k - l k l 2 d = map(int, input().split()) map(int, input().split()) d k, d = map(int, input().split()) map(int, input().split()) k l = x // d x // d l x, k, d = map(int, input().split()) map(int, input().split()) x x = abs(x) abs(x) x
x, k, d = map(int, input().split())
x = abs(x)
l = x // d

if k <= l:
    print(abs(x - k * d))
else:
    print(abs(abs(x - d * l) - d * ((k - l) % 2)))