X,K,D = map(int, input().split())
X = abs(X)
if K*D <= X:
    print(X-K*D)
else:
    tempK = X//D
    if (K-tempK)%2==0:
        print(X-D*tempK)
    else:
        print(abs(X-D*tempK-D)) X,K,D = map(int, input().split()) X map(int, input().split()) map int input().split() ().split () input split K D X = abs(X) X abs(X) abs X if K*D <= X:
    print(X-K*D)
else:
    tempK = X//D
    if (K-tempK)%2==0:
        print(X-D*tempK)
    else:
        print(abs(X-D*tempK-D)) K*D <= X K*D K D X print(X-K*D) print X-K*D X K*D K D tempK = X//D tempK X//D X D if (K-tempK)%2==0:
        print(X-D*tempK)
    else:
        print(abs(X-D*tempK-D)) (K-tempK)%2==0 (K-tempK)%2 K-tempK K tempK 2 0 print(X-D*tempK) print X-D*tempK X D*tempK D tempK print(abs(X-D*tempK-D)) print abs(X-D*tempK-D) abs X-D*tempK-D X-D*tempK X D*tempK D tempK D X,K,D = map(int, input().split()) map(int, input().split()) X D = map(int, input().split()) map(int, input().split()) D K,D = map(int, input().split()) map(int, input().split()) K tempK = X//D X//D tempK X = abs(X) abs(X) X
X,K,D = map(int, input().split())
X = abs(X)
if K*D <= X:
    print(X-K*D)
else:
    tempK = X//D
    if (K-tempK)%2==0:
        print(X-D*tempK)
    else:
        print(abs(X-D*tempK-D))
