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

X = abs(X)

straight = min(K, X // D)

K -= straight;
X -= straight * D;

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 straight = min(K, X // D) straight min(K, X // D) min K X // D X D K -= straight K straight X -= straight * D X straight * D straight 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 X -= straight * D straight * D X X, K, D = [int(x) for x in input().split()] [int(x) for x in input().split()] X D = [int(x) for x in input().split()] [int(x) for x in input().split()] D straight = min(K, X // D) min(K, X // D) straight X = abs(X) abs(X) X K, D = [int(x) for x in input().split()] [int(x) for x in input().split()] K K -= straight straight K
X, K, D = [int(x) for x in input().split()]

X = abs(X)

straight = min(K, X // D)

K -= straight;
X -= straight * D;

if K % 2 == 0:
    print(X)
else:
    print(D - X)
