fun main(args: Array<String>) {
    val S = readLine()!!.map { (it - '0').toLong() }
    var answer = 0L
    for (i in 0 until 1.shl(S.size - 1)) {
        val bits = (0 until S.size - 1).map { i.shr(it).and(1) == 1 }

        var localSum = 0L
        var current = 0L
        for (j in 0 until S.size) {
            current = current * 10L + S[j]
            if (bits.getOrElse(j , { false })) {
                localSum += current
                current = 0L
            } else {
            }
        }
        if (current > 0) {
            localSum += current
        }
        answer += localSum
    }
    println(answer)
}