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

if(x<0):

    x=x*-1

if(x>=k*d):

    print((x-(k*d)))

else:

    r=x%d

    g=x//d

    k=k-g;

    if(k%2==0):

        print(r)

    else:

        ans=min(r+d,abs(r-d))

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

if(x<0):

    x=x*-1

if(x>=k*d):

    print((x-(k*d)))

else:

    r=x%d

    g=x//d

    k=k-g;

    if(k%2==0):

        print(r)

    else:

        ans=abs(r-d)

        print(ans)

x, k, d = list(map(int, input().split()))
if x < 0:
    x = x * -1
if x >= k * d:
    print((x - (k * d)))
else:
    r = x % d
    g = x // d
    k = k - g
    if k % 2 == 0:
        print(r)
    else:
        ans = min(r + d, abs(r - d))
        print(ans)

x, k, d = list(map(int, input().split()))
if x < 0:
    x = x * -1
if x >= k * d:
    print((x - (k * d)))
else:
    r = x % d
    g = x // d
    k = k - g
    if k % 2 == 0:
        print(r)
    else:
        ans = abs(r - d)
        print(ans)

-        ans = min(r + d, abs(r - d)) +        ans = abs(r - d)