fun main(args: Array<String>?): Unit {
    val (c, n, m) = readLine()!!.trim().split(' ').map(String::toInt)
    val memo = Array(c + 1){0L}
    repeat(n){
        val (s, p) = readLine()!!.trim().split(' ').map(String::toInt)
        for (i in (0 .. c - s).reversed()) if (memo[i + s] < memo[i] + p) memo[i + s] = memo[i] + p
    }
    for (i in 1 .. c) memo[i] = java.lang.Math.max(memo[i], memo[i - 1])
    for (k in 1 .. m) println(k * memo[c / k])
}
