object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val s = sc.next().toArray.map(_.toString.toLong)
  var ans = 0L

  for (i <- 0 until 1 << (s.length - 1)) {
    var sum = s(0)
    for (j <- 0 until s.length-1) {
      if (((i >> j) & 1) == 1) {
        ans += sum
        sum = s(j+1)
      } else {
        sum = sum * 10 + s(j+1)
      }
    }
    ans += sum
  }

  println(ans)
}
