from sys import exit
import math
import collections
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

x,k,d = mi()
x = abs(x)

count = min(k,x//d)
k -= count
x -= d*count

if k % 2 == 0:
    print(x)
else:
    print(d-x) from sys import exit import math math import collections collections ii = lambda : int(input()) ii lambda : int(input()) int(input()) int input() input mi = lambda : map(int,input().split()) mi lambda : map(int,input().split()) map(int,input().split()) map int input().split() ().split () input split li = lambda : list(map(int,input().split())) li lambda : list(map(int,input().split())) list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split x,k,d = mi() x mi() mi k d x = abs(x) x abs(x) abs x count = min(k,x//d) count min(k,x//d) min k x//d x d k -= count k count x -= d*count x d*count d count if k % 2 == 0:
    print(x)
else:
    print(d-x) k % 2 == 0 k % 2 k 2 0 print(x) print x print(d-x) print d-x d x x,k,d = mi() mi() x ii = lambda : int(input()) lambda : int(input()) ii k,d = mi() mi() k count = min(k,x//d) min(k,x//d) count mi = lambda : map(int,input().split()) lambda : map(int,input().split()) mi x = abs(x) abs(x) x x -= d*count d*count x li = lambda : list(map(int,input().split())) lambda : list(map(int,input().split())) li d = mi() mi() d k -= count count k
from sys import exit
import math
import collections
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

x,k,d = mi()
x = abs(x)

count = min(k,x//d)
k -= count
x -= d*count

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