struct Scanner {
    private var elements = [String]()
    private var index = 0

    mutating func peek() -> String {
        while elements.count == index {
            elements = readLine()!.split(separator: " ").map(String.init)
            index = 0
        }
        return elements[index]
    }

    mutating func next() -> String {
        let value = peek()
        index += 1
        return value
    }

    mutating func nextInt() -> Int {
        return Int(next())!
    }

    mutating func nextDouble() -> Double {
        return Double(next())!
    }
}

var scanner = Scanner()
let X = abs(scanner.nextInt())
let K = scanner.nextInt()
let D = scanner.nextInt()

if Double(K) * Double(D) >= 1e18 || X <= K * D {
    let count = X / D
    if count % 2 == K % 2 {
        print(X - D * count)
    } else {
        print(D * (count + 1) - X)
    }
} else {
    print(X - K * D)
}

