S = eval(input())

ans = 0

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

	bit = bin(i)[2:].rjust(len(S) - 1, "0")

	start = 0

	tmp = 0

	for j in range(len(bit)):

		if bit[j] == "1":

			tmp += int(S[start: j + 1])

			start = j + 1

		if j == len(bit) - 1:

			tmp += int(S[start:])

	ans += tmp

print(ans)

S = eval(input())

ans = 0



# 値を入れられる場所がlen(S)-1箇所

for i in range(pow(2, len(S)-1)):

    bit = bin(i)[2:].zfill(len(S)-1)

    ind = 0

    res = 0

    for j in range(len(bit)):

        if bit[j] == "1":

            res += int(S[ind:j+1])

            ind = j+1

    res += int(S[ind:])

    ans += res



print(ans)

S = eval(input())
ans = 0
for i in range(2 ** (len(S) - 1)):
    bit = bin(i)[2:].rjust(len(S) - 1, "0")
    start = 0
    tmp = 0
    for j in range(len(bit)):
        if bit[j] == "1":
            tmp += int(S[start : j + 1])
            start = j + 1
        if j == len(bit) - 1:
            tmp += int(S[start:])
    ans += tmp
print(ans)

S = eval(input())
ans = 0
# 値を入れられる場所がlen(S)-1箇所
for i in range(pow(2, len(S) - 1)):
    bit = bin(i)[2:].zfill(len(S) - 1)
    ind = 0
    res = 0
    for j in range(len(bit)):
        if bit[j] == "1":
            res += int(S[ind : j + 1])
            ind = j + 1
    res += int(S[ind:])
    ans += res
print(ans)

-for i in range(2 ** (len(S) - 1)): -    bit = bin(i)[2:].rjust(len(S) - 1, "0") -    start = 0 -    tmp = 0 +# 値を入れられる場所がlen(S)-1箇所 +for i in range(pow(2, len(S) - 1)): +    bit = bin(i)[2:].zfill(len(S) - 1) +    ind = 0 +    res = 0 -            tmp += int(S[start : j + 1]) -            start = j + 1 -        if j == len(bit) - 1: -            tmp += int(S[start:]) -    ans += tmp +            res += int(S[ind : j + 1]) +            ind = j + 1 +    res += int(S[ind:]) +    ans += res