(ns Atcoder.ARC061-A)

(def S (read-line))

(def len (count S))

(defn char2int [c]
  (- (int c) (int \0))
  )
(defn calc [i]
  (loop [j 1 now (char2int (nth S 0)) sum 0]
    (if (= len j)
      (+ sum now)
      (if (= (bit-and 1 (bit-shift-right i (dec j))) 1)
        (recur (inc j) (char2int (nth S j)) (+ sum now))
        (recur (inc j) (+ (* now 10) (char2int (nth S j))) sum)
        )
      )
    )
  )
(def ans (reduce + (for [i (range 0 (Math/pow 2 (dec len)))] (calc i))))
(println ans)