S = eval(input())



res_list = []



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

    temp_s = ''

    for j in range(len(S)):

        temp_s += S[j]

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

            temp_s += '+'

    # print(temp_s)

    res_list.append(temp_s)



temp_S_list = [eval(item) for item in res_list]



print((sum(temp_S_list)))
s = eval(input())

n = len(s)-1

total=0

for i in range(2**n):

  pl=['']*n

  ans=''

  for j in range(n):

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

      pl[n-1-j] = '+'

  for k in range(n):

    ans += s[k]+pl[k]

  ans+=s[-1]

  total += eval(ans)

 

print(total)
S = eval(input())
res_list = []
for i in range(2 ** (len(S) - 1)):
    temp_s = ""
    for j in range(len(S)):
        temp_s += S[j]
        if (i >> j) & 1:
            temp_s += "+"
    # print(temp_s)
    res_list.append(temp_s)
temp_S_list = [eval(item) for item in res_list]
print((sum(temp_S_list)))

s = eval(input())
n = len(s) - 1
total = 0
for i in range(2**n):
    pl = [""] * n
    ans = ""
    for j in range(n):
        if (i >> j) & 1:
            pl[n - 1 - j] = "+"
    for k in range(n):
        ans += s[k] + pl[k]
    ans += s[-1]
    total += eval(ans)
print(total)

-S = eval(input()) -res_list = [] -for i in range(2 ** (len(S) - 1)): -    temp_s = "" -    for j in range(len(S)): -        temp_s += S[j] +s = eval(input()) +n = len(s) - 1 +total = 0 +for i in range(2**n): +    pl = [""] * n +    ans = "" +    for j in range(n): -            temp_s += "+" -    # print(temp_s) -    res_list.append(temp_s) -temp_S_list = [eval(item) for item in res_list] -print((sum(temp_S_list))) +            pl[n - 1 - j] = "+" +    for k in range(n): +        ans += s[k] + pl[k] +    ans += s[-1] +    total += eval(ans) +print(total)