import java.util.Scanner

object Main {
  val sc = new Scanner(System.in)

  def main(args: Array[String]): Unit = {
    val s = sc.next
    val res =
      if(s.length == 1) s.toLong
      else
        (0 until Math.pow(2, s.length - 1).toInt).foldLeft(0L) { (sum, acc) =>
          val ss = acc.toBinaryString.toInt
          val sss = s"%0${s.length - 1}d".format(ss) // s.length = 1 だと、エラーになる
          sum + buildFormula(s, sss)
        }
    println(res)
  }

  def buildFormula(numStr: String, binaryStr: String): Long = {
    val l = binaryStr.zipWithIndex.filter(_._1 == '1').map(_._2 + 1) :+ (binaryStr.length + 1)
    val ll =
      l.foldLeft(0L, 0) { (res, acc) =>
        val (sum, i) = res
        (sum + numStr.substring(i, acc).toLong, acc)
      }._1
    ll
  }
}
