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