fun main(args: Array<String>) {
    val s = readLine()!!.map { c -> c - '0' }
    var result = 0L
    for (i in 0 until (1 shl s.size - 1)) {
        var n = s[0].toLong()
        for (j in 0 until s.size - 1) {
            if ((i shr j) and 1 == 1) {
                result += n
                n = 0
            }
            n = 10 * n + s[j + 1]
        }
        result += n
    }
    println(result)
}
