# coding: utf-8

s='+'.join(list(eval(input())))

ans=0

memo=set()

def check(w,n):

    global ans

    if w in memo:

        return

    memo.add(w)

    ans+=eval(w)

    for i in range(1,n+1):

        count=0

        for j in range(len(w)):

            if w[j]=='+':

                count+=1

                if count==i:

                    check(w[:j]+w[j+1:],n-1)



check(s,(len(s)-1)//2)

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

n=0

ans=0

while n<2**(len(s)-1):

    p=0

    for i in range(len(s)-1):

        if n&(1<<i):

            ans+=int(s[p:i+1])

            p=i+1

    if p<len(s):

        ans+=int(s[p:])

    n+=1

print(ans)



# coding: utf-8
s = "+".join(list(eval(input())))
ans = 0
memo = set()


def check(w, n):
    global ans
    if w in memo:
        return
    memo.add(w)
    ans += eval(w)
    for i in range(1, n + 1):
        count = 0
        for j in range(len(w)):
            if w[j] == "+":
                count += 1
                if count == i:
                    check(w[:j] + w[j + 1 :], n - 1)


check(s, (len(s) - 1) // 2)
print(ans)

s = eval(input())
n = 0
ans = 0
while n < 2 ** (len(s) - 1):
    p = 0
    for i in range(len(s) - 1):
        if n & (1 << i):
            ans += int(s[p : i + 1])
            p = i + 1
    if p < len(s):
        ans += int(s[p:])
    n += 1
print(ans)

-# coding: utf-8 -s = "+".join(list(eval(input()))) +s = eval(input()) +n = 0 -memo = set() - - -def check(w, n): -    global ans -    if w in memo: -        return -    memo.add(w) -    ans += eval(w) -    for i in range(1, n + 1): -        count = 0 -        for j in range(len(w)): -            if w[j] == "+": -                count += 1 -                if count == i: -                    check(w[:j] + w[j + 1 :], n - 1) - - -check(s, (len(s) - 1) // 2) +while n < 2 ** (len(s) - 1): +    p = 0 +    for i in range(len(s) - 1): +        if n & (1 << i): +            ans += int(s[p : i + 1]) +            p = i + 1 +    if p < len(s): +        ans += int(s[p:]) +    n += 1