(* O(|s| 2^|s|) *)
let s = read_line () in
let slen = String.length s in
let f bits =
  let m = slen - 1 in
  let rec split acc i j =
    let aux () = int_of_string (String.sub s i (j - i)) :: acc in
    if j > m then aux ()
    else if bits lsr (m - j) land 1 = 1 then
      split (aux ()) j (j + 1)
    else split acc i (j + 1) in
  split [] 0 1 |> List.fold_left (+) 0 in
let sum = ref 0 in
for i = 0 to 1 lsl (slen - 1) - 1 do
  sum := !sum + f i
done;
Printf.printf "%d\n" !sum