fun main(args: Array<String>) {
    abc045c()
}

fun abc045c() {
    val s = readLine()!!
    if (s.length == 1) return println(s)

    val answer = (0..bits(s.length - 1)).map { i ->
        val expression = listOf(s.first().toString()) +
                s.drop(1).withIndex().map { (if ((i shr it.index) % 2 == 0) "+" else "") + it.value.toString() }
        expression.joinToString("").split("+").map { it.toLong() }.sum()
    }.sum()

    println(answer)
}

private fun bits(x: Int): Int {
    var ret = 1
    repeat(x) { ret *= 2 }
    return ret - 1
}
