S = eval(input())

n = len(S)



ans = 0

for bit in range(1 << (n-1)):

    tmp = S[0]

    for i in range(n-1):

        if bit & (1 << i):

            tmp += "+"

        tmp += S[i+1]

    

    ans += sum(map(int, tmp.split("+")))



print(ans)
s = eval(input())

n = len(s)



def dfs(i,tmp):

    if i == n-1:

        return sum(list(map(int,tmp.split("+"))))

    

    return dfs(i+1, tmp+s[i+1]) + dfs(i+1,tmp+"+"+s[i+1])



print((dfs(0,s[0])))
S = eval(input())
n = len(S)
ans = 0
for bit in range(1 << (n - 1)):
    tmp = S[0]
    for i in range(n - 1):
        if bit & (1 << i):
            tmp += "+"
        tmp += S[i + 1]
    ans += sum(map(int, tmp.split("+")))
print(ans)

s = eval(input())
n = len(s)


def dfs(i, tmp):
    if i == n - 1:
        return sum(list(map(int, tmp.split("+"))))
    return dfs(i + 1, tmp + s[i + 1]) + dfs(i + 1, tmp + "+" + s[i + 1])


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

-S = eval(input()) -n = len(S) -ans = 0 -for bit in range(1 << (n - 1)): -    tmp = S[0] -    for i in range(n - 1): -        if bit & (1 << i): -            tmp += "+" -        tmp += S[i + 1] -    ans += sum(map(int, tmp.split("+"))) -print(ans) +s = eval(input()) +n = len(s) + + +def dfs(i, tmp): +    if i == n - 1: +        return sum(list(map(int, tmp.split("+")))) +    return dfs(i + 1, tmp + s[i + 1]) + dfs(i + 1, tmp + "+" + s[i + 1]) + + +print((dfs(0, s[0])))