fun main(args: Array<String>) = ARC061C.main()

object ARC061C {
    val S = readLine()!!

    fun main() {
        val nums = S.toList()

        // +の挿入箇所
        val inserts = if (1 < S.length) (1..nums.lastIndex).toList() else emptyList()

        val expressions = BitChoose<Int>().generate(inserts)
            .map { insertPositions ->
                insertPositions.asReversed().let {
                    val buffer = nums.toMutableList()
                    it.forEach { buffer.add(it, '+') }
                    buffer.joinToString("")
                }
            }

        val sums = expressions.map { it.calc() }
        println(sums.sum())
    }

    private fun String.calc(): Long {
        val nums = this.split('+').map { it.toLong() }
        return nums.sum()
    }


    class BitChoose<T> {
        fun generate(items: List<T>): Sequence<List<T>> {
            when {
                items.isEmpty() -> return sequenceOf(listOf())
                else -> {
                    val first = items.last()
                    val remain = items.dropLast(1)
                    val base = generate(remain)
                    return base + base.map { it + first }
                }
            }
        }
    }
}