fun main(arr: Array<String>) {
    val s = readLine()!!
    println(getVariation(s, 0).map { it.split("+").map { it.toLong() }.sum() }.sum())
}

fun getVariation(s:String, idx:Int):List<String> {
    if (idx == s.lastIndex) {
        return listOf(s[idx].toString())
    }
    val ans = mutableListOf<String>()
    val ret = getVariation(s, idx + 1)
    ans.addAll(ret.map { s[idx].toString() + it })
    ans.addAll(ret.map { s[idx].toString() + "+$it" })
    return ans
}
