import io.{StdIn => in}

object Main extends App {
  val s = in.readLine
  val n = s.size
  val ptn = Array.ofDim[Boolean](n)

  def f():Long = {
    var res = 0L
  
    def dfs(idx:Int):Unit = {
      if(idx == n) evaluate
      else {
        ptn(idx) = false
        dfs(idx + 1)
        ptn(idx) = true
        dfs(idx + 1)
      }
    }

    def evaluate():Unit = {
      val sb = StringBuilder.newBuilder
      sb.append(s)
      var pos = 0
      for(i <- 1 until n) {
        if(ptn(i)) {
          sb.insert(i+pos," ")
          pos += 1
        }
      }
      // println(ptn.mkString(" "))
      // println(sb)
      res += sb.toString.split(" ").map(_.toLong).sum
    }

    dfs(1)
    res
  }

  val ans = f()
  println(ans)
}
