import Foundation

var n = readLine()!.split(separator: " ").map{Int($0)!}
if(abs(n[0]) >= n[1] * n[2]){
  print(abs(n[0]) - n[1] * n[2])
}else if(abs(n[1]) % 2 == 1){
  n[0] = abs(n[0]) - n[2]
  var dis = n[0]
  while(dis > 2 * n[2]){
    dis -= 2 * n[2]
  }
  print(dis)
}else{
  var dis = n[0]
  while(dis > 2 * n[2]){
    dis -= 2 * n[2]
  }
  print(dis)
}