S = list(eval(input()))

def dfs(s, i):

  if i == len(S) - 1:

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

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



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

def dfs(s, i):

  if i == len(S) - 1:

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

  return dfs(s + S[i + 1], i + 1) + dfs(f"{s} + {S[i + 1]}", i + 1)

print((dfs(S[0], 0)))
S = list(eval(input()))


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


print((dfs(S[0], 0)))

S = eval(input())


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


print((dfs(S[0], 0)))

-S = list(eval(input())) +S = eval(input()) -    return dfs(s + S[i + 1], i + 1) + dfs(s + "+" + S[i + 1], i + 1) +    return dfs(s + S[i + 1], i + 1) + dfs(f"{s} + {S[i + 1]}", i + 1)