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