def Base_10_to_n(X, n):

    X_dumy = X

    out = ''

    while X_dumy>0:

        out = str(X_dumy%n)+out

        X_dumy = int(X_dumy/n)

    return out



S = eval(input())

N = len(S)-1

ans = 0

for n in range(2**N):

	b = Base_10_to_n(n,2).rjust(N,'0')

	tmp = []

	ind = 0

	for i in range(N):

		if b[i] == '1':

			tmp.append(int(S[ind:i+1]))

			ind = i+1

	tmp.append(int(S[ind:]))

	ans += sum(tmp)



print(ans)
import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines



S = readline().rstrip().decode('utf_8')



def F(S):

	yield int(S)

	for i in range(len(S)-1):

		left = S[:i+1]

		right = S[i+1:]

		x = int(left)

		for y in F(right):

			yield x+y



print((sum(F(S))))
def Base_10_to_n(X, n):
    X_dumy = X
    out = ""
    while X_dumy > 0:
        out = str(X_dumy % n) + out
        X_dumy = int(X_dumy / n)
    return out


S = eval(input())
N = len(S) - 1
ans = 0
for n in range(2**N):
    b = Base_10_to_n(n, 2).rjust(N, "0")
    tmp = []
    ind = 0
    for i in range(N):
        if b[i] == "1":
            tmp.append(int(S[ind : i + 1]))
            ind = i + 1
    tmp.append(int(S[ind:]))
    ans += sum(tmp)
print(ans)

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
S = readline().rstrip().decode("utf_8")


def F(S):
    yield int(S)
    for i in range(len(S) - 1):
        left = S[: i + 1]
        right = S[i + 1 :]
        x = int(left)
        for y in F(right):
            yield x + y


print((sum(F(S))))

-def Base_10_to_n(X, n): -    X_dumy = X -    out = "" -    while X_dumy > 0: -        out = str(X_dumy % n) + out -        X_dumy = int(X_dumy / n) -    return out +import sys + +read = sys.stdin.buffer.read +readline = sys.stdin.buffer.readline +readlines = sys.stdin.buffer.readlines +S = readline().rstrip().decode("utf_8") -S = eval(input()) -N = len(S) - 1 -ans = 0 -for n in range(2**N): -    b = Base_10_to_n(n, 2).rjust(N, "0") -    tmp = [] -    ind = 0 -    for i in range(N): -        if b[i] == "1": -            tmp.append(int(S[ind : i + 1])) -            ind = i + 1 -    tmp.append(int(S[ind:])) -    ans += sum(tmp) -print(ans) +def F(S): +    yield int(S) +    for i in range(len(S) - 1): +        left = S[: i + 1] +        right = S[i + 1 :] +        x = int(left) +        for y in F(right): +            yield x + y + + +print((sum(F(S))))