import sys

from functools import lru_cache



read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines

sys.setrecursionlimit(10 ** 9)

INF = 1 << 60

MOD = 1000000007





def main():

    S = readline().strip()

    N = len(S)



    @lru_cache(maxsize=None)

    def rec(i):

        if i == N:

            return 0



        ans = 0

        for j in range(i + 1, N + 1):

            ans += int(S[i:j]) * pow(2, max(N - j - 1, 0)) + rec(j)



        return ans



    print((rec(0)))

    return





if __name__ == '__main__':

    main()

import sys

from functools import lru_cache



read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines

sys.setrecursionlimit(10 ** 9)

INF = 1 << 60

MOD = 1000000007





def main():

    S = readline().strip()

    N = len(S)



    ans = 0

    for bit in range(1 << (N - 1)):

        vec = []

        for i, s in enumerate(S):

            vec.append(s)

            if bit & (1 << i):

                vec.append('+')

        ans += sum(map(int, ''.join(vec).split('+')))



    print(ans)

    return





if __name__ == '__main__':

    main()

import sys
from functools import lru_cache

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()
    N = len(S)

    @lru_cache(maxsize=None)
    def rec(i):
        if i == N:
            return 0
        ans = 0
        for j in range(i + 1, N + 1):
            ans += int(S[i:j]) * pow(2, max(N - j - 1, 0)) + rec(j)
        return ans

    print((rec(0)))
    return


if __name__ == "__main__":
    main()

import sys
from functools import lru_cache

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60
MOD = 1000000007


def main():
    S = readline().strip()
    N = len(S)
    ans = 0
    for bit in range(1 << (N - 1)):
        vec = []
        for i, s in enumerate(S):
            vec.append(s)
            if bit & (1 << i):
                vec.append("+")
        ans += sum(map(int, "".join(vec).split("+")))
    print(ans)
    return


if __name__ == "__main__":
    main()

- -    @lru_cache(maxsize=None) -    def rec(i): -        if i == N: -            return 0 -        ans = 0 -        for j in range(i + 1, N + 1): -            ans += int(S[i:j]) * pow(2, max(N - j - 1, 0)) + rec(j) -        return ans - -    print((rec(0))) +    ans = 0 +    for bit in range(1 << (N - 1)): +        vec = [] +        for i, s in enumerate(S): +            vec.append(s) +            if bit & (1 << i): +                vec.append("+") +        ans += sum(map(int, "".join(vec).split("+"))) +    print(ans)