S = eval(input())

op_cnt = len(S) - 1



ans = 0



for i in range(2 ** op_cnt):

    op = ["-"] * op_cnt

    for j in range(op_cnt):

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

            op[op_cnt - 1 - j] = "+"

    

    formula = ""

    for p_n, p_o in zip(S, op + [""]):

        if p_o == "+":

            formula += (p_n + p_o)

        else:

            formula += p_n

    ans += eval(formula)



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

ls = len(S)

ans = 0



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

    susiki = ""

    shiki = []  

    for j in range(ls-1):

        if (i >> j) & 1:

            shiki.append("+")

        else:

            shiki.append("")

    

    for k in range(ls):

        if k == ls - 1:

            susiki = susiki + S[k]

        else:

            susiki = susiki + S[k] + shiki[k]

    ans += eval(susiki)



print(ans)
S = eval(input())
op_cnt = len(S) - 1
ans = 0
for i in range(2**op_cnt):
    op = ["-"] * op_cnt
    for j in range(op_cnt):
        if (i >> j) & 1:
            op[op_cnt - 1 - j] = "+"
    formula = ""
    for p_n, p_o in zip(S, op + [""]):
        if p_o == "+":
            formula += p_n + p_o
        else:
            formula += p_n
    ans += eval(formula)
print(ans)

S = eval(input())
ls = len(S)
ans = 0
for i in range(2 ** (ls - 1)):
    susiki = ""
    shiki = []
    for j in range(ls - 1):
        if (i >> j) & 1:
            shiki.append("+")
        else:
            shiki.append("")
    for k in range(ls):
        if k == ls - 1:
            susiki = susiki + S[k]
        else:
            susiki = susiki + S[k] + shiki[k]
    ans += eval(susiki)
print(ans)

-op_cnt = len(S) - 1 +ls = len(S) -for i in range(2**op_cnt): -    op = ["-"] * op_cnt -    for j in range(op_cnt): +for i in range(2 ** (ls - 1)): +    susiki = "" +    shiki = [] +    for j in range(ls - 1): -            op[op_cnt - 1 - j] = "+" -    formula = "" -    for p_n, p_o in zip(S, op + [""]): -        if p_o == "+": -            formula += p_n + p_o +            shiki.append("+") -            formula += p_n -    ans += eval(formula) +            shiki.append("") +    for k in range(ls): +        if k == ls - 1: +            susiki = susiki + S[k] +        else: +            susiki = susiki + S[k] + shiki[k] +    ans += eval(susiki)