S = str(eval(input()))



ans = 0

N = len(S)

for i in range(2**N):

  pattern = bin(i)[2:].zfill(N)

  formula = ''

  for j in range(N):

    mark = ''

    if pattern[j] == '1' and j < N-1:

      mark = '+'

    formula += S[j]+mark

  ans += eval(formula)



print((ans//2))
S = str(eval(input()))



ans = 0

N = len(S)



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

  pattern = bin(i)[2:].zfill((N-1))

  formula = ''

  for j in range(N):

    mark = ''

    if j < N-1:

      if pattern[j] == '1':

        mark = '+'

    formula += S[j]+mark

  ans += eval(formula)



print(ans)
S = str(eval(input()))
ans = 0
N = len(S)
for i in range(2**N):
    pattern = bin(i)[2:].zfill(N)
    formula = ""
    for j in range(N):
        mark = ""
        if pattern[j] == "1" and j < N - 1:
            mark = "+"
        formula += S[j] + mark
    ans += eval(formula)
print((ans // 2))

S = str(eval(input()))
ans = 0
N = len(S)
for i in range(2 ** (N - 1)):
    pattern = bin(i)[2:].zfill((N - 1))
    formula = ""
    for j in range(N):
        mark = ""
        if j < N - 1:
            if pattern[j] == "1":
                mark = "+"
        formula += S[j] + mark
    ans += eval(formula)
print(ans)

-for i in range(2**N): -    pattern = bin(i)[2:].zfill(N) +for i in range(2 ** (N - 1)): +    pattern = bin(i)[2:].zfill((N - 1)) -        if pattern[j] == "1" and j < N - 1: -            mark = "+" +        if j < N - 1: +            if pattern[j] == "1": +                mark = "+" -print((ans // 2)) +print(ans)