import copy

S = eval(input())

n = len(S)

ans = 0

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

    temp = ""

    for s,j in zip(S, list(range(n))):

        temp += s

        if i>>j & 1:

            temp += "+"

    ans += eval(temp)

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

ans = 0

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

    s = ""

    for i in range(len(S)):

        s += S[i]

        if b >> i & 1:

            s += "+"

    ans += eval(s)

print(ans)
import copy

S = eval(input())
n = len(S)
ans = 0
for i in range(2 ** (n - 1)):
    temp = ""
    for s, j in zip(S, list(range(n))):
        temp += s
        if i >> j & 1:
            temp += "+"
    ans += eval(temp)
print(ans)

S = eval(input())
ans = 0
for b in range(2 ** (len(S) - 1)):
    s = ""
    for i in range(len(S)):
        s += S[i]
        if b >> i & 1:
            s += "+"
    ans += eval(s)
print(ans)

-import copy - -n = len(S) -for i in range(2 ** (n - 1)): -    temp = "" -    for s, j in zip(S, list(range(n))): -        temp += s -        if i >> j & 1: -            temp += "+" -    ans += eval(temp) +for b in range(2 ** (len(S) - 1)): +    s = "" +    for i in range(len(S)): +        s += S[i] +        if b >> i & 1: +            s += "+" +    ans += eval(s)