  // C - たくさんの数式 / Many Formulas https://atcoder.jp/contests/abc045/tasks/arc061_a

  import io.Source

  object Main extends App {
    val n = Source.stdin.getLines().next().toInt

    println(solve(n))

    // ↓125
    // 1 + 25 = 26
    // 12 + 5 = 17
    // 1 + 2 + 5 = 8
    // 125 = 125
    // 26 + 17 + 8 + 125 = 176
    def solve(n: Long): String = {
      def loop (s: String, a: Long): Long = {
        if (s.length <= 0) {
          a
        } else {
          var aa = 0L
          for (i <- 1 to s.length) {
            val l = s.substring(0, i)
            val nn = l.toLong
            val r = s.substring(i, s.length)
            aa = aa + loop(r, nn + a)
          }
          aa
        }
      }
      loop(n.toString, 0L).toString
    }
  }
