import scala.collection.mutable
import scala.io.StdIn.readLine

object Main extends App {
  val num = readLine
  var ans = num.toLong

  for (e <- 0 until (1 << num.length - 1)) {
    var bit = e.toBinaryString.toCharArray
    while (bit.length != num.length) {
      bit = '0' +: bit
    }

    var formula = num
    var count = 0
    val index = bit.zipWithIndex.filter(_._1 == '1').map(_._2)
    for (a <- index) {
      formula = formula.patch(a + count, "+", 0)
      count += 1
      if (count == index.length) {
        ans += formula.split('+').map(_.toInt).sum
      }
    }
  }

  println(ans)

}
