    fun main(args: Array<String>) {
        val input = read()
        println(someSums(input))
    }

    data class Inputs(val max: Int, val lower: Int, val higher: Int)

    fun read(): Inputs {
        val args = readLine()!!.split(' ').map { Integer.parseInt(it) }
        return Inputs(args[0], args[1], args[2])
    }

    fun someSums(inputs: Inputs): Int {
        val judge = { value: Int ->
            val sum = value.toString().sumBy { Integer.parseInt(it.toString()) }
            (inputs.lower <= sum && sum <= inputs.higher)
        }

        return (0..inputs.max).filter(judge).sum()
    }