import scala.io.StdIn

object Main extends App {
  val s =  StdIn.readLine()

  def solve(s: String): Long = {
    var ret :Long = s.toLong

    (1 to s.length - 1).foreach {i =>

      (1 to s.length - 1).combinations(i).foreach {j =>

        if (j.isEmpty)
          ret += s.toInt

        (0 to j.length).foreach { k =>
          if (k == 0) {
            ret = ret + s.substring(0, j(k)).toInt
          } else if (k == j.length) {
            ret = ret + s.substring(j(k - 1)).toInt
          } else {
            ret = ret +  s.substring(j(k - 1), j(k)).toInt
          }
        }
      }
    }
    ret
  }

  println(solve(s))
}
  

