let solve n ar =
  let rec inner ans tmp i =
    if i = n then (tmp + ans)
    else
      inner (ans + tmp) (ar.(i)) (i+1)
      |> (+) @@ inner (ans) (tmp * 10 + ar.(i)) (i+1)
  in inner 0 ar.(0) 1 

let _ =
  let temp = Scanf.scanf "%s\n" (fun s -> s) in
  let s = Array.make 10 0 in
  let n = String.length temp in
  for i = 0 to n - 1 do
    s.(i) <- String.get temp i |> (fun c -> Char.code c - Char.code '0')
  done;
  solve n s |> print_int