s=eval(input())

n=len(s)

f=0

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

    a=s[0]

    for j in range(n-1):

        if i&(1<<j):

            a+='+'+s[j+1]

        else:

            a+=s[j+1]

    f+=eval(a)

print(f)
def dfs(i,f):

    if i==n-1:

        return f

    return dfs(i+1,f+s[i+1])+'+'+dfs(i+1,f+'+'+s[i+1])

s=eval(input())

n=len(s)

print((eval(dfs(0,s[0]))))
s = eval(input())
n = len(s)
f = 0
for i in range(1 << n - 1):
    a = s[0]
    for j in range(n - 1):
        if i & (1 << j):
            a += "+" + s[j + 1]
        else:
            a += s[j + 1]
    f += eval(a)
print(f)

def dfs(i, f):
    if i == n - 1:
        return f
    return dfs(i + 1, f + s[i + 1]) + "+" + dfs(i + 1, f + "+" + s[i + 1])


s = eval(input())
n = len(s)
print((eval(dfs(0, s[0]))))

+def dfs(i, f): +    if i == n - 1: +        return f +    return dfs(i + 1, f + s[i + 1]) + "+" + dfs(i + 1, f + "+" + s[i + 1]) + + -f = 0 -for i in range(1 << n - 1): -    a = s[0] -    for j in range(n - 1): -        if i & (1 << j): -            a += "+" + s[j + 1] -        else: -            a += s[j + 1] -    f += eval(a) -print(f) +print((eval(dfs(0, s[0]))))