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

        
N=int(X/D)

if N==0:
    if K%2==0:
        print(X)
    else:
        print(D-X)
else:
    if N>K:
        print(X-K*D)
    elif (K-N)%2==0:
        print(X-N*D)
    else:
        print((N+1)*D-X) 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 N=int(X/D) N int(X/D) int X/D X D if N==0:
    if K%2==0:
        print(X)
    else:
        print(D-X)
else:
    if N>K:
        print(X-K*D)
    elif (K-N)%2==0:
        print(X-N*D)
    else:
        print((N+1)*D-X) N==0 N 0 if K%2==0:
        print(X)
    else:
        print(D-X) K%2==0 K%2 K 2 0 print(X) print X print(D-X) print D-X D X if N>K:
        print(X-K*D)
    elif (K-N)%2==0:
        print(X-N*D)
    else:
        print((N+1)*D-X) N>K N K print(X-K*D) print X-K*D X K*D K D elif (K-N)%2==0:
        print(X-N*D)
     (K-N)%2==0 (K-N)%2 K-N K N 2 0 print(X-N*D) print X-N*D X N*D N D print((N+1)*D-X) print (N+1)*D-X (N+1)*D N+1 N 1 D X N=int(X/D) int(X/D) N K, D=(map(int, input().split())) map(int, input().split()) K D=(map(int, input().split())) map(int, input().split()) D X=abs(X) abs(X) X X, K, D=(map(int, input().split())) map(int, input().split()) X
X, K, D=(map(int, input().split()))
X=abs(X)

        
N=int(X/D)

if N==0:
    if K%2==0:
        print(X)
    else:
        print(D-X)
else:
    if N>K:
        print(X-K*D)
    elif (K-N)%2==0:
        print(X-N*D)
    else:
        print((N+1)*D-X)