open System
open System.Collections
open System.Collections.Generic
open System.IO
open System.Linq

[<AutoOpen>] 
module input =
    let Str()  = Console.ReadLine()
    let Int()  = Str() |> int
    let Char() = Str() |> char
    let CharList()  = [ for c in Str() -> c ]
    let CharArray() = [|for c in Str() -> c|]
[<AutoOpen>] 
module parse =
    let c2s (c:obj) = 
        match c with
        | :? (char[])    as c -> new string(c)
        | :? (char list) as c -> c|>Array.ofList|>String
        | :?  char       as c -> c.ToString()
        | _ -> failwith ""
    let c2i c = c2s(c) |> int

let enumerateSplitElement(str:string) =
    let strArr = [|for c in str ->string c|] |> Array.rev    
    let rec f (elem:string) lis cnt =
        seq{
            if cnt=strArr.Length then 
                yield! [elem::lis]
            else
                yield! f (strArr.[cnt]+elem) lis         (cnt+1)
                yield! f  strArr.[cnt]       (elem::lis) (cnt+1)
        }
    f strArr.[0] [] 1

[<EntryPoint>]
let main _ = 
    let S = Str()

    let ans = 
        Seq.sumBy List.sum (enumerateSplitElement(S)
        |> Seq.map (fun x -> List.map(int64) x))

    printfn "%i" ans

    0
    

