fun main(arg: Array<String>) {
    val S = next()
    val N = S.length - 1
    var ans = 0L
    for (b in 0 until 1.shl(N)) {
        val P = BooleanArray(N + 1)
        for (n in 0 until N) {
            if (b.shr(n).and(1) == 1) P[n] = true
        }
        val Ex = StringBuilder()
        for (n in 0 until N + 1) {
            Ex.append(S[n])
            if (P[n]) Ex.append('+')
        }
        ans += eval(Ex.toString())
    }
    println(ans)
}
fun eval(S: String): Long {
    var nums = 0L
    var num = 0L
    for (c in S) {
        if (c in '0'..'9') num = num * 10 + (c - '0')
        else {
            nums += num
            num = 0L
        }
    }
    if (num > 0) nums += num
    return nums
}
fun next() = readLine()!!
