s=eval(input())

n=len(s)

a=2**(n-1)

t = [bin(i)[2:] for i in range(a)]

for i in range(a):

    t[i]='0'*(n-1-len(t[i]))+t[i]

    t[i]=t[i][::-1]

ans=0

#print(s)

#print(t)

for i in range(a):

    k=0

    for j  in range(n-1):

        if t[i][j]=="1":

            ans+=int(s[k:j+1])

            #print(s[k:j+1])

            k=j+1

            #print(ans,i,j)

    #print("ah",s[k:n])

    ans+=int(s[k:n])

print(ans)
s=eval(input())

n=len(s)-1

ans=0

for i in range(2**n):

    k=0

    for j in range(n):

        if (i>>j)&1:

            ans+=int(s[k:j+1])

            k=j+1

    ans+=int(s[k:])

print(ans)
s = eval(input())
n = len(s)
a = 2 ** (n - 1)
t = [bin(i)[2:] for i in range(a)]
for i in range(a):
    t[i] = "0" * (n - 1 - len(t[i])) + t[i]
    t[i] = t[i][::-1]
ans = 0
# print(s)
# print(t)
for i in range(a):
    k = 0
    for j in range(n - 1):
        if t[i][j] == "1":
            ans += int(s[k : j + 1])
            # print(s[k:j+1])
            k = j + 1
            # print(ans,i,j)
    # print("ah",s[k:n])
    ans += int(s[k:n])
print(ans)

s = eval(input())
n = len(s) - 1
ans = 0
for i in range(2**n):
    k = 0
    for j in range(n):
        if (i >> j) & 1:
            ans += int(s[k : j + 1])
            k = j + 1
    ans += int(s[k:])
print(ans)

-n = len(s) -a = 2 ** (n - 1) -t = [bin(i)[2:] for i in range(a)] -for i in range(a): -    t[i] = "0" * (n - 1 - len(t[i])) + t[i] -    t[i] = t[i][::-1] +n = len(s) - 1 -# print(s) -# print(t) -for i in range(a): +for i in range(2**n): -    for j in range(n - 1): -        if t[i][j] == "1": +    for j in range(n): +        if (i >> j) & 1: -            # print(s[k:j+1]) -            # print(ans,i,j) -    # print("ah",s[k:n]) -    ans += int(s[k:n]) +    ans += int(s[k:])