import itertools as it



S = eval(input())

ans = 0



for bits in it.product((True, False), repeat=len(S)-1):

    A = ''

    for s, bit in zip(S, bits + (0,)):

        A += s + '+'*bit

    ans += eval(A)



print(ans)
S = eval(input())



ans = 0



def dfs(s, sum_, n):

    if n == len(S)-1:

        return int(s) + sum_



    return dfs(s+S[n+1], sum_, n+1) + dfs(S[n+1], sum_+int(s), n+1)



print((dfs(S[0], 0, 0)))
import itertools as it

S = eval(input())
ans = 0
for bits in it.product((True, False), repeat=len(S) - 1):
    A = ""
    for s, bit in zip(S, bits + (0,)):
        A += s + "+" * bit
    ans += eval(A)
print(ans)

S = eval(input())
ans = 0


def dfs(s, sum_, n):
    if n == len(S) - 1:
        return int(s) + sum_
    return dfs(s + S[n + 1], sum_, n + 1) + dfs(S[n + 1], sum_ + int(s), n + 1)


print((dfs(S[0], 0, 0)))

-import itertools as it - -for bits in it.product((True, False), repeat=len(S) - 1): -    A = "" -    for s, bit in zip(S, bits + (0,)): -        A += s + "+" * bit -    ans += eval(A) -print(ans) + + +def dfs(s, sum_, n): +    if n == len(S) - 1: +        return int(s) + sum_ +    return dfs(s + S[n + 1], sum_, n + 1) + dfs(S[n + 1], sum_ + int(s), n + 1) + + +print((dfs(S[0], 0, 0)))