import itertools



s = eval(input())

n = len(s)



l = []

for i in range(1,n):

	l.append(i)



ans = []



for i in range(1,n):

	index = list(itertools.combinations(l,i))

	for j in range(len(index)):

		start = 0

		for k in index[j]:

			ans.append(int(s[start:k]))

			start = k

		ans.append(int(s[k:n]))



print((sum(ans) + int(s)))

s = eval(input())



n = len(s)



ans = 0

for i in range(2**n):

	l = []

	for j in range(n):

		if i & (1 << j):

			l.append(j)

	#print(l)

	string = s

	if len(l) == 0:

		continue

	for k in range(len(l)):

		if l[k] == 0:

			string = '+' + string

		else:

			string = string[:l[k]+k] + '+' + string[l[k]+k:]



	ans += eval(string)



print(((ans + int(s))//2))

import itertools

s = eval(input())
n = len(s)
l = []
for i in range(1, n):
    l.append(i)
ans = []
for i in range(1, n):
    index = list(itertools.combinations(l, i))
    for j in range(len(index)):
        start = 0
        for k in index[j]:
            ans.append(int(s[start:k]))
            start = k
        ans.append(int(s[k:n]))
print((sum(ans) + int(s)))

s = eval(input())
n = len(s)
ans = 0
for i in range(2**n):
    l = []
    for j in range(n):
        if i & (1 << j):
            l.append(j)
    # print(l)
    string = s
    if len(l) == 0:
        continue
    for k in range(len(l)):
        if l[k] == 0:
            string = "+" + string
        else:
            string = string[: l[k] + k] + "+" + string[l[k] + k :]
    ans += eval(string)
print(((ans + int(s)) // 2))

-import itertools - -l = [] -for i in range(1, n): -    l.append(i) -ans = [] -for i in range(1, n): -    index = list(itertools.combinations(l, i)) -    for j in range(len(index)): -        start = 0 -        for k in index[j]: -            ans.append(int(s[start:k])) -            start = k -        ans.append(int(s[k:n])) -print((sum(ans) + int(s))) +ans = 0 +for i in range(2**n): +    l = [] +    for j in range(n): +        if i & (1 << j): +            l.append(j) +    # print(l) +    string = s +    if len(l) == 0: +        continue +    for k in range(len(l)): +        if l[k] == 0: +            string = "+" + string +        else: +            string = string[: l[k] + k] + "+" + string[l[k] + k :] +    ans += eval(string) +print(((ans + int(s)) // 2))