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

if x - k*d > 0:
    print(x - k*d)

elif x - k*d == 0:
    print(0)

else:
    count = x//d + 1
    x -= count * d
    
    if (k - count) % 2 == 0:
        print(abs(x))
    
    else:
        print(x + d) 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 count = 0 count 0 if x - k*d > 0:
    print(x - k*d)

elif x - k*d == 0:
    print(0)

else:
    count = x//d + 1
    x -= count * d
    
    if (k - count) % 2 == 0:
        print(abs(x))
    
    else:
        print(x + d) x - k*d > 0 x - k*d x k*d k d 0 print(x - k*d) print x - k*d x k*d k d elif x - k*d == 0:
    print(0) x - k*d == 0 x - k*d x k*d k d 0 print(0) print 0 count = x//d + 1 count x//d + 1 x//d x d 1 x -= count * d x count * d count d if (k - count) % 2 == 0:
        print(abs(x))
    
    else:
        print(x + d) (k - count) % 2 == 0 (k - count) % 2 k - count k count 2 0 print(abs(x)) print abs(x) abs x print(x + d) print x + d x d count = x//d + 1 x//d + 1 count x = abs(x) abs(x) x x -= count * d count * d x x, k, d = map(int, input().split()) map(int, input().split()) x count = 0 0 count k, d = map(int, input().split()) map(int, input().split()) k d = map(int, input().split()) map(int, input().split()) d
x, k, d = map(int, input().split())
x = abs(x)
count = 0

if x - k*d > 0:
    print(x - k*d)

elif x - k*d == 0:
    print(0)

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