s = [int(x) for x in eval(input())]

##print(s)

count = len(s)-1##+の入りうるポジション数

sum = 0

for bit in range(2**count):

    hugou = [""] * count

    ##print(bin(bit))

    for i in range(count):

        if (bit >> i) & 1:

            hugou[count-1-i] = "+"

            ##print(hugou)

    calc = ""

   

    for j in range(count):

        calc += str(s[j])

        ##print(s)

        calc += str(hugou[j])

        ##print(hugou)

        ##print(calc)

    calc += str(s[-1])

    ##print(calc)

    sum += eval(calc)

print(sum)
s = eval(input())

len = len(s)

ns = list(map(int,s))

total_sum = 0

for bit in range(1 << (len-1)):

  ##print(bit)

  sum_ = 0

  num = ns[0]

  for i in range(1, len):

    if (bit & 1) > 0:

     

      sum_ += num

      num = ns[i]

    else:

      num = (num * 10 + ns[i])

    bit = bit >> 1

  total_sum += sum_ + num

print(total_sum)
s = [int(x) for x in eval(input())]
##print(s)
count = len(s) - 1  ##+の入りうるポジション数
sum = 0
for bit in range(2**count):
    hugou = [""] * count
    ##print(bin(bit))
    for i in range(count):
        if (bit >> i) & 1:
            hugou[count - 1 - i] = "+"
            ##print(hugou)
    calc = ""
    for j in range(count):
        calc += str(s[j])
        ##print(s)
        calc += str(hugou[j])
        ##print(hugou)
        ##print(calc)
    calc += str(s[-1])
    ##print(calc)
    sum += eval(calc)
print(sum)

s = eval(input())
len = len(s)
ns = list(map(int, s))
total_sum = 0
for bit in range(1 << (len - 1)):
    ##print(bit)
    sum_ = 0
    num = ns[0]
    for i in range(1, len):
        if (bit & 1) > 0:
            sum_ += num
            num = ns[i]
        else:
            num = num * 10 + ns[i]
        bit = bit >> 1
    total_sum += sum_ + num
print(total_sum)

-s = [int(x) for x in eval(input())] -##print(s) -count = len(s) - 1  ##+の入りうるポジション数 -sum = 0 -for bit in range(2**count): -    hugou = [""] * count -    ##print(bin(bit)) -    for i in range(count): -        if (bit >> i) & 1: -            hugou[count - 1 - i] = "+" -            ##print(hugou) -    calc = "" -    for j in range(count): -        calc += str(s[j]) -        ##print(s) -        calc += str(hugou[j]) -        ##print(hugou) -        ##print(calc) -    calc += str(s[-1]) -    ##print(calc) -    sum += eval(calc) -print(sum) +s = eval(input()) +len = len(s) +ns = list(map(int, s)) +total_sum = 0 +for bit in range(1 << (len - 1)): +    ##print(bit) +    sum_ = 0 +    num = ns[0] +    for i in range(1, len): +        if (bit & 1) > 0: +            sum_ += num +            num = ns[i] +        else: +            num = num * 10 + ns[i] +        bit = bit >> 1 +    total_sum += sum_ + num +print(total_sum)