X, K, D =map(int,input().split())
X = abs(X)

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

if X > K*D:
  print(X-K*D)
else:
  greed = X//D
  if (K - greed)%2 == 0:
    print(X-greed*D)
  else:
    print((1+greed)*D -X)