S = eval(input())

n = len(S)



ans = 0

for bit in range(2**(n-1)):

    cand = []

    j = 0

    for i in range(n):

        if (bit >> i) & 1:

            cand.append(S[j:i+1])

            j = i + 1

    cand.append(S[j:])

    ans += sum(map(int, cand))

    #print(cand)



print(ans)
def Recursion(S):

    list = []

    list.append(int(S))

    for i in range(len(S)-1):

        left = S[:i+1]

        right = S[i+1:]

        x = int(left)

        for y in Recursion(right):

            list.append(x + y)

    return list



S = eval(input())

print((sum(Recursion(S))))

S = eval(input())
n = len(S)
ans = 0
for bit in range(2 ** (n - 1)):
    cand = []
    j = 0
    for i in range(n):
        if (bit >> i) & 1:
            cand.append(S[j : i + 1])
            j = i + 1
    cand.append(S[j:])
    ans += sum(map(int, cand))
    # print(cand)
print(ans)

def Recursion(S):
    list = []
    list.append(int(S))
    for i in range(len(S) - 1):
        left = S[: i + 1]
        right = S[i + 1 :]
        x = int(left)
        for y in Recursion(right):
            list.append(x + y)
    return list


S = eval(input())
print((sum(Recursion(S))))

+def Recursion(S): +    list = [] +    list.append(int(S)) +    for i in range(len(S) - 1): +        left = S[: i + 1] +        right = S[i + 1 :] +        x = int(left) +        for y in Recursion(right): +            list.append(x + y) +    return list + + -n = len(S) -ans = 0 -for bit in range(2 ** (n - 1)): -    cand = [] -    j = 0 -    for i in range(n): -        if (bit >> i) & 1: -            cand.append(S[j : i + 1]) -            j = i + 1 -    cand.append(S[j:]) -    ans += sum(map(int, cand)) -    # print(cand) -print(ans) +print((sum(Recursion(S))))