S = list(eval(input()))

ans = 0



for state in range(1 << len(S)-1):

    ans += eval(S[0] + ''.join(('+' if state >> i & 1 else '') + x for i, x in enumerate(S[1:])))



print(ans)

S = str(eval(input()))



ans = ""



for mask in range(1 << (len(S)-1)):

    for i in range(len(S)):

        if ((mask >> i) & 1):

            ans += str(S[i]) + "+"

        else:

            ans += str(S[i])

    ans += "+"



print((int(eval(ans[:-1]))))

S = list(eval(input()))
ans = 0
for state in range(1 << len(S) - 1):
    ans += eval(
        S[0] + "".join(("+" if state >> i & 1 else "") + x for i, x in enumerate(S[1:]))
    )
print(ans)

S = str(eval(input()))
ans = ""
for mask in range(1 << (len(S) - 1)):
    for i in range(len(S)):
        if (mask >> i) & 1:
            ans += str(S[i]) + "+"
        else:
            ans += str(S[i])
    ans += "+"
print((int(eval(ans[:-1]))))

-S = list(eval(input())) -ans = 0 -for state in range(1 << len(S) - 1): -    ans += eval( -        S[0] + "".join(("+" if state >> i & 1 else "") + x for i, x in enumerate(S[1:])) -    ) -print(ans) +S = str(eval(input())) +ans = "" +for mask in range(1 << (len(S) - 1)): +    for i in range(len(S)): +        if (mask >> i) & 1: +            ans += str(S[i]) + "+" +        else: +            ans += str(S[i]) +    ans += "+" +print((int(eval(ans[:-1]))))