S = eval(input())

tf_str = ""



ans = 0



def dfs(tf_str,S):

    global ans

    if len(tf_str) != len(S)-1:

        dfs(tf_str + "f",S)

        dfs(tf_str + "t",S)

    else:

        frm = 0

        for to in range(1,len(S)):

            if tf_str[to-1] == "t":

                ans += int(S[frm:to])

                frm = to

        

        ans += int(S[frm:])





dfs(tf_str,S)   

print(ans)
s = input()



d = len(s) - 1



def dfs(depth: int, cur:int, s: str, res: str) -> int:

    if depth == d:

        tmp = s + res[:1]

        return cur + int(tmp)

    

    else:

        tmp = s + res[:1]

        return dfs(depth+1, cur+int(tmp), "", res[1:]) \

                + dfs(depth+1, cur, tmp, res[1:])

                

ans = dfs(0, 0, "", s)



print(ans)

S = eval(input())
tf_str = ""
ans = 0


def dfs(tf_str, S):
    global ans
    if len(tf_str) != len(S) - 1:
        dfs(tf_str + "f", S)
        dfs(tf_str + "t", S)
    else:
        frm = 0
        for to in range(1, len(S)):
            if tf_str[to - 1] == "t":
                ans += int(S[frm:to])
                frm = to
        ans += int(S[frm:])


dfs(tf_str, S)
print(ans)

s = input()
d = len(s) - 1


def dfs(depth: int, cur: int, s: str, res: str) -> int:
    if depth == d:
        tmp = s + res[:1]
        return cur + int(tmp)
    else:
        tmp = s + res[:1]
        return dfs(depth + 1, cur + int(tmp), "", res[1:]) + dfs(
            depth + 1, cur, tmp, res[1:]
        )


ans = dfs(0, 0, "", s)
print(ans)

-S = eval(input()) -tf_str = "" -ans = 0 +s = input() +d = len(s) - 1 -def dfs(tf_str, S): -    global ans -    if len(tf_str) != len(S) - 1: -        dfs(tf_str + "f", S) -        dfs(tf_str + "t", S) +def dfs(depth: int, cur: int, s: str, res: str) -> int: +    if depth == d: +        tmp = s + res[:1] +        return cur + int(tmp) -        frm = 0 -        for to in range(1, len(S)): -            if tf_str[to - 1] == "t": -                ans += int(S[frm:to]) -                frm = to -        ans += int(S[frm:]) +        tmp = s + res[:1] +        return dfs(depth + 1, cur + int(tmp), "", res[1:]) + dfs( +            depth + 1, cur, tmp, res[1:] +        ) -dfs(tf_str, S) +ans = dfs(0, 0, "", s)