import javax.script.ScriptEngineManager
fun main(arg: Array<String>) {
    val S = next()
    val N = S.length - 1
    val manager = ScriptEngineManager()
    val engine = manager.getEngineByName("js")
    var ans = 0L
    for (b in 0 until 1.shl(N)) {
        val P = BooleanArray(N)
        for (n in 0 until N) {
            if (b.shr(n).and(1) == 1) P[n] = true
        }
        val Ex = StringBuilder()
        for (n in 0 until N) {
            Ex.append(S[n])
            if (P[n]) Ex.append('+')
        }
        Ex.append(S.last())
        ans += "${engine.eval(Ex.toString())}".toDouble().toLong()
    }
    println(ans)
}

fun next() = readLine()!!
