s = eval(input())

chk = []

def f(a,b):

  if a==len(b):

    chk.append(eval(b))

  else:

    return f(a+1,b),f(a+2,b[:a]+'+'+b[a:])

f(1,s)

print((sum(chk)))
s = eval(input())

l = len(s)-1

ans = 0



for j in range(2**l):

  L = 0

  for i in range(l):

    if (j>>i)&1 == 1:

      m = s[L:i+1]

      ans += int(m)

      L = i+1

  ans += int(s[L:])

print(ans) 
s = eval(input())
chk = []


def f(a, b):
    if a == len(b):
        chk.append(eval(b))
    else:
        return f(a + 1, b), f(a + 2, b[:a] + "+" + b[a:])


f(1, s)
print((sum(chk)))

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

-chk = [] - - -def f(a, b): -    if a == len(b): -        chk.append(eval(b)) -    else: -        return f(a + 1, b), f(a + 2, b[:a] + "+" + b[a:]) - - -f(1, s) -print((sum(chk))) +l = len(s) - 1 +ans = 0 +for j in range(2**l): +    L = 0 +    for i in range(l): +        if (j >> i) & 1 == 1: +            m = s[L : i + 1] +            ans += int(m) +            L = i + 1 +    ans += int(s[L:]) +print(ans)