fun main(args: Array<String>) {
    val s = readLine()!!
    var ans = 0L
    for (i in 0 until (1 shl (s.length - 1))) {
        var x = 0L
        var cur = 0
        for (j in 0 until s.length - 1) {
            if (i shr j and 1 == 1) {
                x += s.slice(cur..j).toLong()
                cur = j + 1
            }
        }
        x += s.slice(cur until s.length).toLong()
        ans += x
    }
    println(ans)
}
