fun main(args: Array<String>) {
  val s = readLine()!!
  val n = s.length
  var ans = 0L
  var k = 0L
  for (b in 0 until (1 shl (n - 1))) {
    var t = 0L
    for (i in 0 until n) {
      k = k * 10L + (s[i].toLong() - '0'.toLong())
      if ((b shr i) and 1 == 1) {
        t += k
        k = 0
      }
    }
    t += k
    k = 0
    ans += t
  }
  println(ans)
}
