(* O(2^|s|) *)
let s = read_line () in
let ds = Array.init (String.length s) @@ fun i -> int_of_char s.[i] - 48 in
let f bits =
  let n = ref ds.(0) in
  let m = Array.length ds - 1 in
  let acc = ref 0 in
  for i = 1 to m do
    if bits lsr (m - i) land 1 = 1 then
      (acc := !acc + !n;
      n := ds.(i))
    else n := !n * 10 + ds.(i)
  done;
  !acc + !n in
let sum = ref 0 in
for i = 0 to 1 lsl (Array.length ds - 1) - 1 do
  sum := !sum + f i
done;
Printf.printf "%d\n" !sum