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