import sys

S=eval(input())



def allbitCalc(N):

    allbit = []

    for i in range(2**N):

        bit = [0] * N

        for j in range(N):

            if (i >> j) & 1:

                bit[j] = 1

        allbit.append(bit)

    return allbit



def split(S,bit):

    n=len(S)

    terms=[]

    cnt=1;s=int(S[n-1])

    for i,b in enumerate(bit):

        if b==0:

            s+=int(S[n-i-2])*10**cnt

            cnt+=1

        else:

            terms.append(s)

            s=0;cnt=0

            s+=int(S[n-i-2])*10**cnt

            cnt+=1



    terms.append(s)

    return(sum(terms))

        

summ=0

allb=allbitCalc(int(len(S))-1)

for ab in allb:

    tmp=split(S,ab)

    summ+=tmp



print(summ)
def dfs(i,s):

    if i==(n-1):

        return(sum(map(int,s.split('+'))))

    return(dfs(i+1,s+S[i+1])+dfs(i+1,s+'+'+S[i+1]))





S=eval(input())

n=len(S)

ans=dfs(0,S[0])

print(ans)
import sys

S = eval(input())


def allbitCalc(N):
    allbit = []
    for i in range(2**N):
        bit = [0] * N
        for j in range(N):
            if (i >> j) & 1:
                bit[j] = 1
        allbit.append(bit)
    return allbit


def split(S, bit):
    n = len(S)
    terms = []
    cnt = 1
    s = int(S[n - 1])
    for i, b in enumerate(bit):
        if b == 0:
            s += int(S[n - i - 2]) * 10**cnt
            cnt += 1
        else:
            terms.append(s)
            s = 0
            cnt = 0
            s += int(S[n - i - 2]) * 10**cnt
            cnt += 1
    terms.append(s)
    return sum(terms)


summ = 0
allb = allbitCalc(int(len(S)) - 1)
for ab in allb:
    tmp = split(S, ab)
    summ += tmp
print(summ)

def dfs(i, s):
    if i == (n - 1):
        return sum(map(int, s.split("+")))
    return dfs(i + 1, s + S[i + 1]) + dfs(i + 1, s + "+" + S[i + 1])


S = eval(input())
n = len(S)
ans = dfs(0, S[0])
print(ans)

-import sys +def dfs(i, s): +    if i == (n - 1): +        return sum(map(int, s.split("+"))) +    return dfs(i + 1, s + S[i + 1]) + dfs(i + 1, s + "+" + S[i + 1]) + - - -def allbitCalc(N): -    allbit = [] -    for i in range(2**N): -        bit = [0] * N -        for j in range(N): -            if (i >> j) & 1: -                bit[j] = 1 -        allbit.append(bit) -    return allbit - - -def split(S, bit): -    n = len(S) -    terms = [] -    cnt = 1 -    s = int(S[n - 1]) -    for i, b in enumerate(bit): -        if b == 0: -            s += int(S[n - i - 2]) * 10**cnt -            cnt += 1 -        else: -            terms.append(s) -            s = 0 -            cnt = 0 -            s += int(S[n - i - 2]) * 10**cnt -            cnt += 1 -    terms.append(s) -    return sum(terms) - - -summ = 0 -allb = allbitCalc(int(len(S)) - 1) -for ab in allb: -    tmp = split(S, ab) -    summ += tmp -print(summ) +n = len(S) +ans = dfs(0, S[0]) +print(ans)