s = eval(input())

L = []

sigma = 0

def sprit_sum(string, sprit, num):

    global sigma

    for i in range(1,len(string)+num-sprit):

        str_front = string[:i]

        str_back = string[i:]

        L.append(int(str_front)) 

        if num < sprit:

            sprit_sum(str_back, sprit, num+1)

        else:

            L.append(int(str_back))

            for x in L:

                sigma += x

            L.pop()

        L.pop()

        

for j in range(len(s)):

    sprit_sum(s, j+1, 1)

sigma += int(s)

print(sigma)

S = eval(input())

f = lambda x: 2**(x-1) if x > 0 else 1

lenS = len(S)

ans = 0

for i in range(1,lenS+1):

    for j in range(lenS-i+1):

        ans += int(S[j:j+i]) * f(j) * f(lenS-j-i) 

print(ans)
s = eval(input())
L = []
sigma = 0


def sprit_sum(string, sprit, num):
    global sigma
    for i in range(1, len(string) + num - sprit):
        str_front = string[:i]
        str_back = string[i:]
        L.append(int(str_front))
        if num < sprit:
            sprit_sum(str_back, sprit, num + 1)
        else:
            L.append(int(str_back))
            for x in L:
                sigma += x
            L.pop()
        L.pop()


for j in range(len(s)):
    sprit_sum(s, j + 1, 1)
sigma += int(s)
print(sigma)

S = eval(input())
f = lambda x: 2 ** (x - 1) if x > 0 else 1
lenS = len(S)
ans = 0
for i in range(1, lenS + 1):
    for j in range(lenS - i + 1):
        ans += int(S[j : j + i]) * f(j) * f(lenS - j - i)
print(ans)

-s = eval(input()) -L = [] -sigma = 0 - - -def sprit_sum(string, sprit, num): -    global sigma -    for i in range(1, len(string) + num - sprit): -        str_front = string[:i] -        str_back = string[i:] -        L.append(int(str_front)) -        if num < sprit: -            sprit_sum(str_back, sprit, num + 1) -        else: -            L.append(int(str_back)) -            for x in L: -                sigma += x -            L.pop() -        L.pop() - - -for j in range(len(s)): -    sprit_sum(s, j + 1, 1) -sigma += int(s) -print(sigma) +S = eval(input()) +f = lambda x: 2 ** (x - 1) if x > 0 else 1 +lenS = len(S) +ans = 0 +for i in range(1, lenS + 1): +    for j in range(lenS - i + 1): +        ans += int(S[j : j + i]) * f(j) * f(lenS - j - i) +print(ans)