input_line = input().split()
x = int(input_line[0])
k = int(input_line[1])
d = int(input_line[2])

x = abs(x)
y = int(x/d)

if y < k:
  x -= y * d
  if (k-y) % 2 == 1:
    x -= d

else:
  x -= k*d
    
print(abs(x)) input_line = input().split() input_line input().split() ().split () input split x = int(input_line[0]) x int(input_line[0]) int input_line[0] input_line 0 k = int(input_line[1]) k int(input_line[1]) int input_line[1] input_line 1 d = int(input_line[2]) d int(input_line[2]) int input_line[2] input_line 2 x = abs(x) x abs(x) abs x y = int(x/d) y int(x/d) int x/d x d if y < k:
  x -= y * d
  if (k-y) % 2 == 1:
    x -= d

else:
  x -= k*d
     y < k y k x -= y * d x y * d y d if (k-y) % 2 == 1:
    x -= d (k-y) % 2 == 1 (k-y) % 2 k-y k y 2 1 x -= d x d x -= k*d x k*d k d print(abs(x)) print abs(x) abs x y = int(x/d) int(x/d) y input_line = input().split() input().split() input_line x -= k*d k*d x x -= y * d y * d x x -= d d x k = int(input_line[1]) int(input_line[1]) k d = int(input_line[2]) int(input_line[2]) d x = abs(x) abs(x) x x = int(input_line[0]) int(input_line[0]) x
input_line = input().split()
x = int(input_line[0])
k = int(input_line[1])
d = int(input_line[2])

x = abs(x)
y = int(x/d)

if y < k:
  x -= y * d
  if (k-y) % 2 == 1:
    x -= d

else:
  x -= k*d
    
print(abs(x))
