fun main(args: Array<String>) {
    val S = readInputLine().toCharArray().map { (it - '0').toLong() }

    var ans = 0L

    for (bit in 0 until (1 shl (S.size - 1))) {
        var tmp = 0L
        for (i in 0 until S.size) {
            tmp = tmp * 10 + S[i]
            if (bit and (1 shl i) != 0) {
                ans += tmp
                tmp = 0L
            }
        }
        ans += tmp
    }

    println(ans)
}

fun readInputLine(): String {
    return readLine()!!
}
