fun main(args: Array<String>) {
    val s = readLine()!!
    val l = s.length
    print((0 until (1 shl (l-1))).map{bit ->
        val ppositions = (0 until l-1).filter { bit and (1 shl it) != 0}.map{it + 1}.toMutableList().apply {
            add(0, 0)
            if(l !in this) add(this.size, l)
        }
        (0..ppositions.size-2).map{i ->
            s.substring(ppositions[i], ppositions[i+1]).toLong()
        }.sum()
    }.sum())
}