(*
#load "str.cma"
*)
let str_insert str pos s =
  let pre = Str.string_before str pos in
  let suf = Str.string_after str pos in
  pre ^ s ^ suf

let str_eval str =
  List.fold_left (fun x y -> x + int_of_string y) 0
  (Str.split (Str.regexp "+") str)
              
let make_all_list str =
  let rec loop str pos =
    if pos >= (String.length str) then [str]
    else
      loop (str_insert str pos "+") (pos+2) @ loop str (pos+1)
  in loop str 1

let main () =
  let num = read_line () in
  let l = make_all_list num in
  let ans = List.fold_left (fun x y -> x + str_eval y) 0 l in
  print_int ans;print_newline()
;;

  main ()

                          
