S = input().strip()



answer = 0



for n in range(2**(len(S)-1)):

    A = [0]

    for d in range(9):

        if n & (1 << d):

            A.append(d+1)

    T = []

    #print("A", A)

    for l, r in zip(A, A[1:]):

        T.append(int("".join(S[l:r])))

    T.append(int("".join(S[A[-1]:])))

    answer += sum(T)



print(answer)

from itertools import combinations

S = input().strip()

N = len(S)

answer = int(S)

for c in range(1,N):

    for t in combinations(list(range(1,N)), c):

        i = 0

        for j in t:

            answer += int(S[i:j])

            i = j

        j = N

        answer += int(S[i:j])



print(answer)





S = input().strip()
answer = 0
for n in range(2 ** (len(S) - 1)):
    A = [0]
    for d in range(9):
        if n & (1 << d):
            A.append(d + 1)
    T = []
    # print("A", A)
    for l, r in zip(A, A[1:]):
        T.append(int("".join(S[l:r])))
    T.append(int("".join(S[A[-1] :])))
    answer += sum(T)
print(answer)

from itertools import combinations

S = input().strip()
N = len(S)
answer = int(S)
for c in range(1, N):
    for t in combinations(list(range(1, N)), c):
        i = 0
        for j in t:
            answer += int(S[i:j])
            i = j
        j = N
        answer += int(S[i:j])
print(answer)

+from itertools import combinations + -answer = 0 -for n in range(2 ** (len(S) - 1)): -    A = [0] -    for d in range(9): -        if n & (1 << d): -            A.append(d + 1) -    T = [] -    # print("A", A) -    for l, r in zip(A, A[1:]): -        T.append(int("".join(S[l:r]))) -    T.append(int("".join(S[A[-1] :]))) -    answer += sum(T) +N = len(S) +answer = int(S) +for c in range(1, N): +    for t in combinations(list(range(1, N)), c): +        i = 0 +        for j in t: +            answer += int(S[i:j]) +            i = j +        j = N +        answer += int(S[i:j])