import math

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

abs_x = abs(x)

max_len = math.ceil(abs_x/d)*d
min_len = max_len-d

if abs_x-k*d >= 0:
    print(abs_x-k*d)
    exit()

if (math.ceil(abs_x/d)-1)%2 == k%2:
    print(abs(abs_x-min_len))
else:
    print(abs(abs_x-max_len)) import math math x,k,d = map(int,input().split()) x map(int,input().split()) map int input().split() ().split () input split k d abs_x = abs(x) abs_x abs(x) abs x max_len = math.ceil(abs_x/d)*d max_len math.ceil(abs_x/d)*d math.ceil(abs_x/d) math.ceil math ceil abs_x/d abs_x d d min_len = max_len-d min_len max_len-d max_len d if abs_x-k*d >= 0:
    print(abs_x-k*d)
    exit() abs_x-k*d >= 0 abs_x-k*d abs_x k*d k d 0 print(abs_x-k*d) print abs_x-k*d abs_x k*d k d exit() exit if (math.ceil(abs_x/d)-1)%2 == k%2:
    print(abs(abs_x-min_len))
else:
    print(abs(abs_x-max_len)) (math.ceil(abs_x/d)-1)%2 == k%2 (math.ceil(abs_x/d)-1)%2 math.ceil(abs_x/d)-1 math.ceil(abs_x/d) math.ceil math ceil abs_x/d abs_x d 1 2 k%2 k 2 print(abs(abs_x-min_len)) print abs(abs_x-min_len) abs abs_x-min_len abs_x min_len print(abs(abs_x-max_len)) print abs(abs_x-max_len) abs abs_x-max_len abs_x max_len abs_x = abs(x) abs(x) abs_x k,d = map(int,input().split()) map(int,input().split()) k x,k,d = map(int,input().split()) map(int,input().split()) x min_len = max_len-d max_len-d min_len max_len = math.ceil(abs_x/d)*d math.ceil(abs_x/d)*d max_len d = map(int,input().split()) map(int,input().split()) d
import math

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

abs_x = abs(x)

max_len = math.ceil(abs_x/d)*d
min_len = max_len-d

if abs_x-k*d >= 0:
    print(abs_x-k*d)
    exit()

if (math.ceil(abs_x/d)-1)%2 == k%2:
    print(abs(abs_x-min_len))
else:
    print(abs(abs_x-max_len))