import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val s = sc.nextLong()
    println(solve(s, 0L))
}

fun solve(s: Long, sum: Long): Long {
    var res = sum + s
    var p = 10L
    while (p <= s) {
        res += solve(s % p, sum + s / p)
        p *= 10
    }
    return res
}
