S=eval(input())

ans=0

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

    tmp=S[0]

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

        if i&(1<<j):tmp+="+"

        tmp+=S[j+1]

    ans+=eval(tmp)

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

ans=0

for i in range(len(S)):

    for j in range(i+1):

        ans+=int(S[-(i+1)])*(10**j)*(2**(len(S)-1))//(2**min(i,j+1))

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

S = eval(input())
ans = 0
for i in range(len(S)):
    for j in range(i + 1):
        ans += (
            int(S[-(i + 1)]) * (10**j) * (2 ** (len(S) - 1)) // (2 ** min(i, j + 1))
        )
print(ans)

-for i in range(2 ** (len(S) - 1)): -    tmp = S[0] -    for j in range(len(S) - 1): -        if i & (1 << j): -            tmp += "+" -        tmp += S[j + 1] -    ans += eval(tmp) +for i in range(len(S)): +    for j in range(i + 1): +        ans += ( +            int(S[-(i + 1)]) * (10**j) * (2 ** (len(S) - 1)) // (2 ** min(i, j + 1)) +        )