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

if abs(x) >= k * d:
    print(abs(x) - k * d)
else:
    a = abs(abs(x) - (abs(x) // d) * d)
    k -= (abs(x) // d)
    if k % 2 == 0:
        print(a)
    else:
        print(abs(a - d))
 x, k, d = map(int, input().split()) x map(int, input().split()) map int input().split() ().split () input split k d if abs(x) >= k * d:
    print(abs(x) - k * d)
else:
    a = abs(abs(x) - (abs(x) // d) * d)
    k -= (abs(x) // d)
    if k % 2 == 0:
        print(a)
    else:
        print(abs(a - d)) 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 a = abs(abs(x) - (abs(x) // d) * d) a abs(abs(x) - (abs(x) // d) * d) abs abs(x) - (abs(x) // d) * d abs(x) abs x (abs(x) // d) * d abs(x) // d abs(x) abs x d d k -= (abs(x) // d) k abs(x) // d abs(x) abs x d if k % 2 == 0:
        print(a)
    else:
        print(abs(a - d)) k % 2 == 0 k % 2 k 2 0 print(a) print a print(abs(a - d)) print abs(a - d) abs a - d a d x, k, d = map(int, input().split()) map(int, input().split()) x d = map(int, input().split()) map(int, input().split()) d a = abs(abs(x) - (abs(x) // d) * d) abs(abs(x) - (abs(x) // d) * d) a k -= (abs(x) // d) abs(x) // d k k, d = map(int, input().split()) map(int, input().split()) k
x, k, d = map(int, input().split())

if abs(x) >= k * d:
    print(abs(x) - k * d)
else:
    a = abs(abs(x) - (abs(x) // d) * d)
    k -= (abs(x) // d)
    if k % 2 == 0:
        print(a)
    else:
        print(abs(a - d))

