import sys

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

if k <= x // d:
    ans = x - k*d
    print(ans)
    sys.exit()

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

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

if k <= x // d:
    ans = x - k*d
    print(ans)
    sys.exit()

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