fun main(arr:Array<String>) {
    val s = readLine()!!
    numbers.addAll(s.map { it.toString().toInt() })
    val ans = getAns(0, 0L, 0L)
    println(ans)
}

fun getAns(index:Int, subTotal:Long, prev:Long):Long {
    if(index >= numbers.size) {
        return subTotal + prev
    }
    var ret = getAns(index+1, subTotal + prev, numbers[index].toLong())
    if(index > 0) {
        ret += getAns(index+1, subTotal, prev*10+numbers[index])
    }
    return ret
}
val numbers = mutableListOf<Int>()