S = eval(input())





def solve(current = '', index=0):

    if index is len(S) - 1:

        return eval(current + S[index])

    return solve(current + S[index], index + 1) + solve(current + S[index] + '+', index + 1)





print((solve()))

S = eval(input())





def solve(current='', index=0):

    if index is len(S) - 1:

        return eval(current + S[index])

    return solve(current + S[index], index + 1) + solve(current + S[index] + '+', index + 1)





def solve2():

    total = 0

    for source in range(1 << (len(S) - 1)):

        # in binary '1' means '+'

        # 125 ->  1 (source bit:0 ) + 2 + '(+ if (source bit: 1) & 1)

        current = ''

        for i, s in enumerate(S):

            current = current + s

            if (source >> i) & 1:

                total += int(current)

                current = ''

        total += int(current)

    return total



print((solve2()))

S = eval(input())


def solve(current="", index=0):
    if index is len(S) - 1:
        return eval(current + S[index])
    return solve(current + S[index], index + 1) + solve(
        current + S[index] + "+", index + 1
    )


print((solve()))

S = eval(input())


def solve(current="", index=0):
    if index is len(S) - 1:
        return eval(current + S[index])
    return solve(current + S[index], index + 1) + solve(
        current + S[index] + "+", index + 1
    )


def solve2():
    total = 0
    for source in range(1 << (len(S) - 1)):
        # in binary '1' means '+'
        # 125 ->  1 (source bit:0 ) + 2 + '(+ if (source bit: 1) & 1)
        current = ""
        for i, s in enumerate(S):
            current = current + s
            if (source >> i) & 1:
                total += int(current)
                current = ""
        total += int(current)
    return total


print((solve2()))

-print((solve())) +def solve2(): +    total = 0 +    for source in range(1 << (len(S) - 1)): +        # in binary '1' means '+' +        # 125 ->  1 (source bit:0 ) + 2 + '(+ if (source bit: 1) & 1) +        current = "" +        for i, s in enumerate(S): +            current = current + s +            if (source >> i) & 1: +                total += int(current) +                current = "" +        total += int(current) +    return total + + +print((solve2()))