Module Module1

    Dim SS() As String

    Sub Main()
        Dim str As String = Console.ReadLine
        Dim S(str.Length - 1) As String

        For i As Integer = 0 To str.Length - 1
            S(i) = str.Substring(i, 1)
        Next

        SS = S

        Console.WriteLine(Dfs(0, SS(0)))
        Debug.WriteLine(Dfs(0, SS(0)))
    End Sub

    Function Dfs(i As Integer, f As String) As Long

        If i >= SS.Length - 1 Then
            Dim arr() As Long = Array.ConvertAll(Of String, Long)(f.Split("+"), AddressOf Long.Parse)
            Dim r As Long = 0
            For Each a In arr
                r += a
            Next
            Return r
        End If

        ' 分割しない場合＋分割する場合
        Return Dfs(i + 1, f + SS(i + 1)) + Dfs(i + 1, f + "+" + SS(i + 1))

    End Function
End Module
