let XKD: [Int] = readLine()!.split(separator: " ").map { Int($0)! }
let (X, K, D) = (abs(XKD[0]), XKD[1], XKD[2])

let posiMaxNum: Int = X / D
if posiMaxNum > K {
    print(X - K*D)
} else {
    let posiMin: Int = X - D * posiMaxNum
    let negaMin: Int = posiMin - D
    if (K - posiMaxNum) % 2 == 0 {
        print(posiMin)
    } else {
        print(abs(negaMin))
    }
}