#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  x, k, d = map(int, input().strip().split())
  x = abs(x)
  if x >= k * d:
    print(x - k * d)
  else:
    k -= (x // d)
    print(abs(x % d - (k % 2) * d))

if __name__=='__main__':
  main()
 def main():
  x, k, d = map(int, input().strip().split())
  x = abs(x)
  if x >= k * d:
    print(x - k * d)
  else:
    k -= (x // d)
    print(abs(x % d - (k % 2) * d)) main x, k, d = map(int, input().strip().split()) x map(int, input().strip().split()) map int input().strip().split() ().strip().split ().strip() ().strip () input strip split k d x = abs(x) x abs(x) abs x if x >= k * d:
    print(x - k * d)
  else:
    k -= (x // d)
    print(abs(x % d - (k % 2) * d)) x >= k * d x k * d k d print(x - k * d) print x - k * d x k * d k d k -= (x // d) k x // d x d print(abs(x % d - (k % 2) * d)) print abs(x % d - (k % 2) * d) abs x % d - (k % 2) * d x % d x d (k % 2) * d k % 2 k 2 d if __name__=='__main__':
  main() __name__=='__main__' __name__ '__main__' main() main def main():
  x, k, d = map(int, input().strip().split())
  x = abs(x)
  if x >= k * d:
    print(x - k * d)
  else:
    k -= (x // d)
    print(abs(x % d - (k % 2) * d)) def main():
  x, k, d = map(int, input().strip().split())
  x = abs(x)
  if x >= k * d:
    print(x - k * d)
  else:
    k -= (x // d)
    print(abs(x % d - (k % 2) * d)) main
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  x, k, d = map(int, input().strip().split())
  x = abs(x)
  if x >= k * d:
    print(x - k * d)
  else:
    k -= (x // d)
    print(abs(x % d - (k % 2) * d))

if __name__=='__main__':
  main()

