object Main extends App {
  val str = io.StdIn.readLine()
  val len = str.length
  var sum: Long = 0
  for (i <- 1 to 1 << (len-1)) {
    var j = i
    var begin = 0
    for (end <- 1 until len) {
      if ((j & 1) == 1) {
        sum += str.substring(begin, end).toLong
        begin = end
      }
      j = j >> 1
    }
    sum += str.substring(begin).toLong
  }
  println(sum)
}