s = eval(input())

result_sum = 0

plus_count = len(s) - 1



for bit in range(1 << plus_count):

  splitted_string = s[0]

  for iter_plus in range(plus_count):

    if bit & (1 << iter_plus):

      splitted_string += '+'

    splitted_string += s[iter_plus+1]

  result_sum += eval(splitted_string)



print(result_sum)
s = eval(input())

result_sum = 0 # 総和 

plus_count = len(s) - 1 # 集合の要素数



for bit in range(1 << plus_count): # bit全探索

  splitted_string = s[0] # 最初の数字を取る

  for iter_plus in range(plus_count):

    if bit & (1 << iter_plus): # ビットを立てる -> +を挿入する

      splitted_string += '+'

    splitted_string += s[iter_plus+1] # 適宜+が入った状態で数字列が構築

    

  # +で区切って,それぞれintに変換し合計

  splitted_integer = [int(x) for x in splitted_string.split('+')]

  result_sum += sum(splitted_integer)

print(result_sum)
s = eval(input())
result_sum = 0
plus_count = len(s) - 1
for bit in range(1 << plus_count):
    splitted_string = s[0]
    for iter_plus in range(plus_count):
        if bit & (1 << iter_plus):
            splitted_string += "+"
        splitted_string += s[iter_plus + 1]
    result_sum += eval(splitted_string)
print(result_sum)

s = eval(input())
result_sum = 0  # 総和
plus_count = len(s) - 1  # 集合の要素数
for bit in range(1 << plus_count):  # bit全探索
    splitted_string = s[0]  # 最初の数字を取る
    for iter_plus in range(plus_count):
        if bit & (1 << iter_plus):  # ビットを立てる -> +を挿入する
            splitted_string += "+"
        splitted_string += s[iter_plus + 1]  # 適宜+が入った状態で数字列が構築
    # +で区切って,それぞれintに変換し合計
    splitted_integer = [int(x) for x in splitted_string.split("+")]
    result_sum += sum(splitted_integer)
print(result_sum)

-result_sum = 0 -plus_count = len(s) - 1 -for bit in range(1 << plus_count): -    splitted_string = s[0] +result_sum = 0  # 総和 +plus_count = len(s) - 1  # 集合の要素数 +for bit in range(1 << plus_count):  # bit全探索 +    splitted_string = s[0]  # 最初の数字を取る -        if bit & (1 << iter_plus): +        if bit & (1 << iter_plus):  # ビットを立てる -> +を挿入する -        splitted_string += s[iter_plus + 1] -    result_sum += eval(splitted_string) +        splitted_string += s[iter_plus + 1]  # 適宜+が入った状態で数字列が構築 +    # +で区切って,それぞれintに変換し合計 +    splitted_integer = [int(x) for x in splitted_string.split("+")] +    result_sum += sum(splitted_integer)