s = list(map(str, eval(input())))



def Base_10_to_n(X, n):

    if (int(X/n)):

        return Base_10_to_n(int(X/n), n)+str(X%n)

    return str(X%n)





ans = 0



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

	if i == 0:

		ans += int("".join(s))

		continue



	b = Base_10_to_n(i,2).rjust(len(s)-1, "0")

	ind = [j for j in range(len(b)) if b[j] == "1"]



	temp = []



	if len(ind) == 1:

		temp.append("".join(s[:ind[0]+1]))

		temp.append("".join(s[ind[0]+1:]))

		ans += sum(list(map(int, temp)))

		continue



	if len(ind) >= 2:

		for k in range(len(ind)):

			if k == 0:

				temp.append("".join(s[:ind[k]+1]))

			if 0 < k <= len(ind)-1:

				temp.append("".join(s[ind[k-1]+1:ind[k]+1]))

			if k == len(ind)-1:

				temp.append("".join(s[ind[k]+1:]))



		ans += sum(list(map(int, temp)))

		continue



print(ans)
S = list(map(int, eval(input())))



n = len(S)

ans = []

def f(ind, cnt, keta):

	if ind == 0:

		ans.append(cnt)

		return



	f(ind-1, cnt+S[ind-1], 0)

	f(ind-1, cnt+S[ind-1]*(10**(keta+1)), keta+1)





f(len(S)-1, S[-1], 0)



print((sum(ans)))
s = list(map(str, eval(input())))


def Base_10_to_n(X, n):
    if int(X / n):
        return Base_10_to_n(int(X / n), n) + str(X % n)
    return str(X % n)


ans = 0
for i in range(2 ** (len(s) - 1)):
    if i == 0:
        ans += int("".join(s))
        continue
    b = Base_10_to_n(i, 2).rjust(len(s) - 1, "0")
    ind = [j for j in range(len(b)) if b[j] == "1"]
    temp = []
    if len(ind) == 1:
        temp.append("".join(s[: ind[0] + 1]))
        temp.append("".join(s[ind[0] + 1 :]))
        ans += sum(list(map(int, temp)))
        continue
    if len(ind) >= 2:
        for k in range(len(ind)):
            if k == 0:
                temp.append("".join(s[: ind[k] + 1]))
            if 0 < k <= len(ind) - 1:
                temp.append("".join(s[ind[k - 1] + 1 : ind[k] + 1]))
            if k == len(ind) - 1:
                temp.append("".join(s[ind[k] + 1 :]))
        ans += sum(list(map(int, temp)))
        continue
print(ans)

S = list(map(int, eval(input())))
n = len(S)
ans = []


def f(ind, cnt, keta):
    if ind == 0:
        ans.append(cnt)
        return
    f(ind - 1, cnt + S[ind - 1], 0)
    f(ind - 1, cnt + S[ind - 1] * (10 ** (keta + 1)), keta + 1)


f(len(S) - 1, S[-1], 0)
print((sum(ans)))

-s = list(map(str, eval(input()))) +S = list(map(int, eval(input()))) +n = len(S) +ans = [] -def Base_10_to_n(X, n): -    if int(X / n): -        return Base_10_to_n(int(X / n), n) + str(X % n) -    return str(X % n) +def f(ind, cnt, keta): +    if ind == 0: +        ans.append(cnt) +        return +    f(ind - 1, cnt + S[ind - 1], 0) +    f(ind - 1, cnt + S[ind - 1] * (10 ** (keta + 1)), keta + 1) -ans = 0 -for i in range(2 ** (len(s) - 1)): -    if i == 0: -        ans += int("".join(s)) -        continue -    b = Base_10_to_n(i, 2).rjust(len(s) - 1, "0") -    ind = [j for j in range(len(b)) if b[j] == "1"] -    temp = [] -    if len(ind) == 1: -        temp.append("".join(s[: ind[0] + 1])) -        temp.append("".join(s[ind[0] + 1 :])) -        ans += sum(list(map(int, temp))) -        continue -    if len(ind) >= 2: -        for k in range(len(ind)): -            if k == 0: -                temp.append("".join(s[: ind[k] + 1])) -            if 0 < k <= len(ind) - 1: -                temp.append("".join(s[ind[k - 1] + 1 : ind[k] + 1])) -            if k == len(ind) - 1: -                temp.append("".join(s[ind[k] + 1 :])) -        ans += sum(list(map(int, temp))) -        continue -print(ans) +f(len(S) - 1, S[-1], 0) +print((sum(ans)))