fun main(args: Array<String>) {
    val s = readLine()?.toLong() ?: return
    val sList = mutableListOf<Long>()
    var tmp = s
    while (tmp > 0) {
        sList += (tmp % 10)
        tmp /= 10
    }

    sList.reverse()

    var total = 0L
    
    for (flg in 0 until Math.pow(2.0, sList.size - 1.0).toInt()) {
        val numList = mutableListOf<Long>()
        var currentNum = 0L
        for (i in 0 until sList.size) {
            currentNum *= 10
            currentNum += sList[i]
            if (flg.and(1 shl i) == 1 shl i) {
                numList += currentNum
                currentNum = 0
            }
        }
        numList += currentNum
        total += numList.sum()
    }
    println(total)
}