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