import copy



def culc(array):

    summy = 0

    indexes = [i for i, x in enumerate(array) if x == '+']

    ff = 0

    for i in indexes:

        summy += int("".join(array[ff:i]))

        ff = i+1

    summy += int("".join(array[ff:]))

    return summy



nums = list(eval(input()))

ans = 0



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

    bit = bin(i)

    obj = copy.deepcopy(nums)

    k = 0

    for j in range(len(nums)-1):

        if ( i >> j) & 1:

            obj.insert(j+1+k,'+')

            k += 1

    ans += culc(obj)



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

ans = 0



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

    tmp = S

    p = list(bin(i))

    flag = ['0' for _ in range(len(S) - len(p) + 1)] + p[2:]

    nums = []

    l = 0

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

        if flag[j] == '1':

            nums.append("".join(tmp[l:j+1]))

            l = j+1

    nums.append("".join(tmp[l:]))

    for n in nums:

        ans += int(n)



print(ans)

import copy


def culc(array):
    summy = 0
    indexes = [i for i, x in enumerate(array) if x == "+"]
    ff = 0
    for i in indexes:
        summy += int("".join(array[ff:i]))
        ff = i + 1
    summy += int("".join(array[ff:]))
    return summy


nums = list(eval(input()))
ans = 0
for i in range(2 ** (len(nums) - 1)):
    bit = bin(i)
    obj = copy.deepcopy(nums)
    k = 0
    for j in range(len(nums) - 1):
        if (i >> j) & 1:
            obj.insert(j + 1 + k, "+")
            k += 1
    ans += culc(obj)
print(ans)

S = list(eval(input()))
ans = 0
for i in range(2 ** (len(S) - 1)):
    tmp = S
    p = list(bin(i))
    flag = ["0" for _ in range(len(S) - len(p) + 1)] + p[2:]
    nums = []
    l = 0
    for j in range(len(S) - 1):
        if flag[j] == "1":
            nums.append("".join(tmp[l : j + 1]))
            l = j + 1
    nums.append("".join(tmp[l:]))
    for n in nums:
        ans += int(n)
print(ans)

-import copy - - -def culc(array): -    summy = 0 -    indexes = [i for i, x in enumerate(array) if x == "+"] -    ff = 0 -    for i in indexes: -        summy += int("".join(array[ff:i])) -        ff = i + 1 -    summy += int("".join(array[ff:])) -    return summy - - -nums = list(eval(input())) +S = list(eval(input())) -for i in range(2 ** (len(nums) - 1)): -    bit = bin(i) -    obj = copy.deepcopy(nums) -    k = 0 -    for j in range(len(nums) - 1): -        if (i >> j) & 1: -            obj.insert(j + 1 + k, "+") -            k += 1 -    ans += culc(obj) +for i in range(2 ** (len(S) - 1)): +    tmp = S +    p = list(bin(i)) +    flag = ["0" for _ in range(len(S) - len(p) + 1)] + p[2:] +    nums = [] +    l = 0 +    for j in range(len(S) - 1): +        if flag[j] == "1": +            nums.append("".join(tmp[l : j + 1])) +            l = j + 1 +    nums.append("".join(tmp[l:])) +    for n in nums: +        ans += int(n)