S = eval(input())

T = [letter for letter in S]

que = [T]

a = 0

while que:

	T1 = que[0]

	if len(T1) > 1:

		a += int(T1[0])*2**(len(T1) - 2)

		t2 = T1[:]

		t2[1] = t2[0] + t2[1]

		t2 = t2[1:]

		que.append(t2)

		t1 = T1[1:]

		que.append(t1)

	else:

		a += int(T1[0])

	que = que[1:]

print(a)
S = [int(n) for n in eval(input())]

l = len(S)

ans = 0

for i in range(l):

	for j in range(l-i):

		if i+j == l-1:

			t = 1

		else:

			t = 2

		ans += S[i]*10**j*2**(l-j-t)

print(ans)

S = eval(input())
T = [letter for letter in S]
que = [T]
a = 0
while que:
    T1 = que[0]
    if len(T1) > 1:
        a += int(T1[0]) * 2 ** (len(T1) - 2)
        t2 = T1[:]
        t2[1] = t2[0] + t2[1]
        t2 = t2[1:]
        que.append(t2)
        t1 = T1[1:]
        que.append(t1)
    else:
        a += int(T1[0])
    que = que[1:]
print(a)

S = [int(n) for n in eval(input())]
l = len(S)
ans = 0
for i in range(l):
    for j in range(l - i):
        if i + j == l - 1:
            t = 1
        else:
            t = 2
        ans += S[i] * 10**j * 2 ** (l - j - t)
print(ans)

-S = eval(input()) -T = [letter for letter in S] -que = [T] -a = 0 -while que: -    T1 = que[0] -    if len(T1) > 1: -        a += int(T1[0]) * 2 ** (len(T1) - 2) -        t2 = T1[:] -        t2[1] = t2[0] + t2[1] -        t2 = t2[1:] -        que.append(t2) -        t1 = T1[1:] -        que.append(t1) -    else: -        a += int(T1[0]) -    que = que[1:] -print(a) +S = [int(n) for n in eval(input())] +l = len(S) +ans = 0 +for i in range(l): +    for j in range(l - i): +        if i + j == l - 1: +            t = 1 +        else: +            t = 2 +        ans += S[i] * 10**j * 2 ** (l - j - t) +print(ans)