fun main() {
    val s = readLine() ?: return
    var t = s.toLong()

    fun count(str: String, plus: Int): Pair<Long, Int> {
        var c = 0L
        var p = 0
        if (plus == 1) {
            1.until(str.length).forEach {
                val a = str.take(it).toLong()
                val b = str.takeLast(str.length - it).toLong()
                c += a + b
                p++
            }
        } else {
            1.until(str.length - plus + 1).forEach {
                val r = count(str.drop(it), plus - 1)
                c += str.take(it).toLong() * r.second + r.first
                p += r.second
            }
        }
        return Pair(c, p)
    }

    1.until(s.length).forEach {
        t += count(s, it).first
    }
    println(t.toString())
}
