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

ax = abs(x)

kd = k*d

if(ax>kd):
    print(ax-kd)
else:
    num = ax//d
    if((num%2)==(k%2)):
        print(ax-(d*num))
    else:
        if(num==k):
            print(ax-d*num)
        else:
            print(abs(ax-d*num-d))

     x,k,d = map(int,input().split()) x map(int,input().split()) map int input().split() ().split () input split k d ax = abs(x) ax abs(x) abs x kd = k*d kd k*d k d if(ax>kd):
    print(ax-kd)
else:
    num = ax//d
    if((num%2)==(k%2)):
        print(ax-(d*num))
    else:
        if(num==k):
            print(ax-d*num)
        else:
            print(abs(ax-d*num-d))

     ax>kd ax kd print(ax-kd) print ax-kd ax kd num = ax//d num ax//d ax d if((num%2)==(k%2)):
        print(ax-(d*num))
    else:
        if(num==k):
            print(ax-d*num)
        else:
            print(abs(ax-d*num-d))

     (num%2)==(k%2) num%2 num 2 k%2 k 2 print(ax-(d*num)) print ax-(d*num) ax d*num d num if(num==k):
            print(ax-d*num)
        else:
            print(abs(ax-d*num-d))

     num==k num k print(ax-d*num) print ax-d*num ax d*num d num print(abs(ax-d*num-d)) print abs(ax-d*num-d) abs ax-d*num-d ax-d*num ax d*num d num d k,d = map(int,input().split()) map(int,input().split()) k kd = k*d k*d kd ax = abs(x) abs(x) ax x,k,d = map(int,input().split()) map(int,input().split()) x d = map(int,input().split()) map(int,input().split()) d num = ax//d ax//d num
x,k,d = map(int,input().split())

ax = abs(x)

kd = k*d

if(ax>kd):
    print(ax-kd)
else:
    num = ax//d
    if((num%2)==(k%2)):
        print(ax-(d*num))
    else:
        if(num==k):
            print(ax-d*num)
        else:
            print(abs(ax-d*num-d))

    
