fun main(args: Array<String>) {
    val s = readLine()!!
    var len = s.length

    var ans = 0L
    for (bit in 0 until (1 shl len-1)) {
        var num = (s[0] - '0').toLong()
        for (i in 0 until len-1) {
            if (bit and (1 shl i) != 0) {
                ans += num
                num = 0
            }
            num = 10 * num + (s[i + 1] - '0')
        }
        ans += num
    }
    println(ans)
}