import Foundation

func main() {
    let inputString = readLine()!
    var array: [Int] = inputString.components(separatedBy: " ").map{Int(String($0))!}
    
    var x = array[0]
    if x < 0 {
        x = x * -1
    }
    var k = array[1]
    let d = array[2]
    
    var res = x
    var exp = 0
    while res > exp {
        exp = res
        res -= d
        k -= 1
        
         if res<0 {
            res = res * -1
        } else if res == 0 && k > 0{
            print(exp)
            return
        }
    }
    
    if res<0 {
        res = res * -1
    }
    
    print(res)
}

main()