import java.util.Scanner

fun main(args: Array<String>){
    val scn = Scanner(System.`in`)

    val str = scn.nextLine()
    val n = str.length - 1

    if(n==0){
        print(str)
        return
    }

    var sum = 0L
    var bit = 0
    while(bit < (1 shl n)){

        var st = StringBuilder(str)
        var count = 1
        (0 until n).forEach { i ->
            if ((1 and (bit shr i)) == 1){
                st.insert(i+count, '+')
                count++
            }
        }
        sum += st.split("+").map(String::toLong).sum()

        bit++
    }

    print(sum)

}