s=eval(input())

n=len(s)-1

sum=0

List=[s[0]]

for i in range(2**n):

    for j in range(n):

        if (i>>j)&1:

            List+=["+"]+[s[j+1]]

        else:

            List+=[s[j+1]]

    m=0

    for h in List:

        if h=="+":

            sum+=m

            m=0

        else:

            m*=10

            m+=int(h)

    sum+=m

    List=[s[0]]

print(sum)

           
S=eval(input())

n=len(S)

ans=0

for i in range(2**(n-1)):

  s=0

  c=int(S[0])

  for j in range(n-1):

    if (i>>j) & 1:

      s+=c

      c=int(S[j+1])

    else:

      c*=10

      c+=int(S[j+1])

  ans+=s+c

print(ans)
s = eval(input())
n = len(s) - 1
sum = 0
List = [s[0]]
for i in range(2**n):
    for j in range(n):
        if (i >> j) & 1:
            List += ["+"] + [s[j + 1]]
        else:
            List += [s[j + 1]]
    m = 0
    for h in List:
        if h == "+":
            sum += m
            m = 0
        else:
            m *= 10
            m += int(h)
    sum += m
    List = [s[0]]
print(sum)

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

-s = eval(input()) -n = len(s) - 1 -sum = 0 -List = [s[0]] -for i in range(2**n): -    for j in range(n): +S = eval(input()) +n = len(S) +ans = 0 +for i in range(2 ** (n - 1)): +    s = 0 +    c = int(S[0]) +    for j in range(n - 1): -            List += ["+"] + [s[j + 1]] +            s += c +            c = int(S[j + 1]) -            List += [s[j + 1]] -    m = 0 -    for h in List: -        if h == "+": -            sum += m -            m = 0 -        else: -            m *= 10 -            m += int(h) -    sum += m -    List = [s[0]] -print(sum) +            c *= 10 +            c += int(S[j + 1]) +    ans += s + c +print(ans)