X, K, D = [int(x) for x in input().split()]

X=abs(X)
s = min(K, X//D)
K = K - s
X = X - s*D
#print(s, K, X)
if K%2 == 0:
    print(X)
else:
    print(D-X) int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x X, K, D = [int(x) for x in input().split()] X [int(x) for x in input().split()] K D X=abs(X) X abs(X) abs X s = min(K, X//D) s min(K, X//D) min K X//D X D K = K - s K K - s K s X = X - s*D X X - s*D X s*D s D 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 s = min(K, X//D) min(K, X//D) s X, K, D = [int(x) for x in input().split()] [int(x) for x in input().split()] X K, D = [int(x) for x in input().split()] [int(x) for x in input().split()] K X=abs(X) abs(X) X X = X - s*D X - s*D X K = K - s K - s K D = [int(x) for x in input().split()] [int(x) for x in input().split()] D
X, K, D = [int(x) for x in input().split()]

X=abs(X)
s = min(K, X//D)
K = K - s
X = X - s*D
#print(s, K, X)
if K%2 == 0:
    print(X)
else:
    print(D-X)