import numpy as np



S = eval(input())

b = np.zeros(len(S)-1)

num = 0

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

    str = S[0]

    for k in range(len(S)-1):

        if b[k] == 0:

            str = str + S[k+1]

        else:

            str = str + "+" + S[k+1]

            

    num += eval(str)

    

    b[0] += 1

    for k in range(len(S)-1):

        if b[k] == 2:

            b[k+1] += 1

            b[k] = 0

            

str = S[0]

for k in range(len(S)-1):

    if b[k] == 0:

        str = str + S[k+1]

    else:

        str = str + "+" + S[k+1]

            

    

num += eval(str)



print(num)
S = eval(input())

allsum = 0



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

    bi = format(i,"b")

    bi = "0" * (len(S) - len(bi) - 1) + bi

    st = S[0]

    stsum = 0

    for k in range(len(S) - 1):

        if bi[k] == "0":

            stsum += int(st)

            st = S[k+1]

        else:

            st = st + S[k+1]

    stsum += int(st)

    allsum += stsum

print(allsum)
import numpy as np

S = eval(input())
b = np.zeros(len(S) - 1)
num = 0
for i in range(2 ** (len(S) - 1) - 1):
    str = S[0]
    for k in range(len(S) - 1):
        if b[k] == 0:
            str = str + S[k + 1]
        else:
            str = str + "+" + S[k + 1]
    num += eval(str)
    b[0] += 1
    for k in range(len(S) - 1):
        if b[k] == 2:
            b[k + 1] += 1
            b[k] = 0
str = S[0]
for k in range(len(S) - 1):
    if b[k] == 0:
        str = str + S[k + 1]
    else:
        str = str + "+" + S[k + 1]
num += eval(str)
print(num)

S = eval(input())
allsum = 0
for i in range(2 ** (len(S) - 1)):
    bi = format(i, "b")
    bi = "0" * (len(S) - len(bi) - 1) + bi
    st = S[0]
    stsum = 0
    for k in range(len(S) - 1):
        if bi[k] == "0":
            stsum += int(st)
            st = S[k + 1]
        else:
            st = st + S[k + 1]
    stsum += int(st)
    allsum += stsum
print(allsum)

-import numpy as np - -b = np.zeros(len(S) - 1) -num = 0 -for i in range(2 ** (len(S) - 1) - 1): -    str = S[0] +allsum = 0 +for i in range(2 ** (len(S) - 1)): +    bi = format(i, "b") +    bi = "0" * (len(S) - len(bi) - 1) + bi +    st = S[0] +    stsum = 0 -        if b[k] == 0: -            str = str + S[k + 1] +        if bi[k] == "0": +            stsum += int(st) +            st = S[k + 1] -            str = str + "+" + S[k + 1] -    num += eval(str) -    b[0] += 1 -    for k in range(len(S) - 1): -        if b[k] == 2: -            b[k + 1] += 1 -            b[k] = 0 -str = S[0] -for k in range(len(S) - 1): -    if b[k] == 0: -        str = str + S[k + 1] -    else: -        str = str + "+" + S[k + 1] -num += eval(str) -print(num) +            st = st + S[k + 1] +    stsum += int(st) +    allsum += stsum +print(allsum)