fun main(args: Array<String>) {
    val S = readString().map { it - '0' }

    fun f(sum: Long, tmp: Long, i: Int): Long {
        if (i == S.size) return sum + tmp
        return f(sum + tmp, S[i].toLong(), i + 1) + f(sum, 10 * tmp + S[i], i + 1)
    }

    println(f(0, S[0].toLong(), 1))
}

fun readString() = readLine()!!