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

    var ans = 0L

    for (i: Int in 0 until (1 shl s.length - 1)) {
        var tmp: Long = (s[0] - '0').toLong()
        for (b: Int in 0 until s.length - 1) {
            if (1 and (i shr b) == 1) {
                ans += tmp
                tmp = (s[b + 1] - '0').toLong()
            } else {
                tmp = tmp * 10 + (s[b + 1] - '0')
            }
        }
        ans += tmp
    }

    println(ans)
}