(* O(2^|s|) *)
let s = read_line () in
let ds = Array.to_list @@ Array.init (String.length s) @@ fun i -> int_of_char s.[i] - 48 in
let rec calc sum n = function
| [] -> sum + n
| d :: ds2 -> calc (sum + n) d ds2 + calc sum (10 * n + d) ds2 in
calc 0 (List.hd ds) (List.tl ds) |> Printf.printf "%d\n"