x,k,d=map(int, input().split())
if abs(x)//d>=k:
    #print("ひ")
    print(abs(x)-d*k)
elif (k-abs(x)//d)%2==0:
    #print("fu")
    print(abs(x)%d)
else:
    #print("mi")
    print(d-abs(x)%d)
 x,k,d=map(int, input().split()) x map(int, input().split()) map int input().split() ().split () input split k d if abs(x)//d>=k:
    #print("ひ")
    print(abs(x)-d*k)
elif (k-abs(x)//d)%2==0:
    #print("fu")
    print(abs(x)%d)
else:
    #print("mi")
    print(d-abs(x)%d) abs(x)//d>=k abs(x)//d abs(x) abs x d k print(abs(x)-d*k) print abs(x)-d*k abs(x) abs x d*k d k elif (k-abs(x)//d)%2==0:
    #print("fu")
    print(abs(x)%d) (k-abs(x)//d)%2==0 (k-abs(x)//d)%2 k-abs(x)//d k abs(x)//d abs(x) abs x d 2 0 print(abs(x)%d) print abs(x)%d abs(x) abs x d print(d-abs(x)%d) print d-abs(x)%d d abs(x)%d abs(x) abs x d x,k,d=map(int, input().split()) map(int, input().split()) x 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())
if abs(x)//d>=k:
    #print("ひ")
    print(abs(x)-d*k)
elif (k-abs(x)//d)%2==0:
    #print("fu")
    print(abs(x)%d)
else:
    #print("mi")
    print(d-abs(x)%d)

