import sys





def input():

    return sys.stdin.readline().rstrip()





def main():

    X,K,D =list(map(int,input().split()))

    ans =10**19

    if X >= K*D:

        print((X-K*D))

    elif -X>= K*D:

        print((-X - K*D))



    else:

        X =abs(X)

        c =X//D

        if (K-c)%2  ==0:

            print((X-c*D))

        else:

            print((D*(c+1)-X))

















if __name__ == "__main__":

    main()

import sys





def input():

    return sys.stdin.readline().rstrip()





def main():

    X,K,D =list(map(int,input().split()))

    X= abs(X)

    if X >= K*D:

        print((X-K*D))



    else:

        c =X//D

        if (K-c)%2  ==0:

            print((X-c*D))

        else:

            print((D*(c+1)-X))

















if __name__ == "__main__":

    main()

import sys


def input():
    return sys.stdin.readline().rstrip()


def main():
    X, K, D = list(map(int, input().split()))
    ans = 10**19
    if X >= K * D:
        print((X - K * D))
    elif -X >= K * D:
        print((-X - K * D))
    else:
        X = abs(X)
        c = X // D
        if (K - c) % 2 == 0:
            print((X - c * D))
        else:
            print((D * (c + 1) - X))


if __name__ == "__main__":
    main()

import sys


def input():
    return sys.stdin.readline().rstrip()


def main():
    X, K, D = list(map(int, input().split()))
    X = abs(X)
    if X >= K * D:
        print((X - K * D))
    else:
        c = X // D
        if (K - c) % 2 == 0:
            print((X - c * D))
        else:
            print((D * (c + 1) - X))


if __name__ == "__main__":
    main()

-    ans = 10**19 +    X = abs(X) -    elif -X >= K * D: -        print((-X - K * D)) -        X = abs(X)