s = eval(input())

space = len(s) - 1

total = []

for i in range(2 ** space):

    pluses = [''] * space

    for j in range(space):

        if (i >> j) & 1:

            pluses[j] = '+'

    re = ''

    for a, b in zip(s, pluses + ['']):

        re += (a + b)

    total.append(eval(re))

ans = sum(total)

print(ans)
s = eval(input())

l = len(s)



#全部で2**(l-1)パターンある

ans = 0

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

    eq = s[0]

    for j in range(l-1):

        if i & (1<<j):

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

        else:

            eq += s[j+1]

    tmp = list(map(int, eq.split('+')))

    ans += sum([int(chr) for chr in tmp])



print(ans)
s = eval(input())
space = len(s) - 1
total = []
for i in range(2**space):
    pluses = [""] * space
    for j in range(space):
        if (i >> j) & 1:
            pluses[j] = "+"
    re = ""
    for a, b in zip(s, pluses + [""]):
        re += a + b
    total.append(eval(re))
ans = sum(total)
print(ans)

s = eval(input())
l = len(s)
# 全部で2**(l-1)パターンある
ans = 0
for i in range(2 ** (l - 1)):
    eq = s[0]
    for j in range(l - 1):
        if i & (1 << j):
            eq += "+" + s[j + 1]
        else:
            eq += s[j + 1]
    tmp = list(map(int, eq.split("+")))
    ans += sum([int(chr) for chr in tmp])
print(ans)

-space = len(s) - 1 -total = [] -for i in range(2**space): -    pluses = [""] * space -    for j in range(space): -        if (i >> j) & 1: -            pluses[j] = "+" -    re = "" -    for a, b in zip(s, pluses + [""]): -        re += a + b -    total.append(eval(re)) -ans = sum(total) +l = len(s) +# 全部で2**(l-1)パターンある +ans = 0 +for i in range(2 ** (l - 1)): +    eq = s[0] +    for j in range(l - 1): +        if i & (1 << j): +            eq += "+" + s[j + 1] +        else: +            eq += s[j + 1] +    tmp = list(map(int, eq.split("+"))) +    ans += sum([int(chr) for chr in tmp])