from collections import defaultdict





# all_split("abc") -> [['abc'], ['ab', 'c'], ['a', 'bc'], ['a', 'b', 'c']]

def all_split(s):

    if len(s) == 1:

        return [s]



    ans = []

    for i in range(2 ** (len(s) - 1)):

        b = list(map(int, format(i, "0" + str(len(s) - 1) + "b")))

        ans.append(split(s, b))

    return ans





def split(s, split_positions):

    assert len(s) - 1 == len(split_positions)



    ans = []

    pre = 0

    for i, is_split in enumerate(split_positions, start=1):

        if is_split:

            ans.append(s[pre:i])

            pre = i



    ans.append(s[pre:])

    return ans





def main():

    s = eval(input())

    ans = 0

    for x in all_split(s):

        ans += eval("+".join(x))

    print(ans)





if __name__ == '__main__':

    main()

from collections import defaultdict





def main():

    S = eval(input())

    ans = 0

    # 2 ^ nの組み合わせの全列挙

    n = len(S) - 1

    for b in range(2 ** n):

        p_list = [i for i in range(n) if b & 1 << i]

        x, s = [], S[:]

        for p in p_list[::-1]:

            a, s = s[p + 1:], s[:p + 1]

            x.append(a)

        if s:

            x.append(s)

        ans += eval("+".join(x))



    print(ans)



if __name__ == '__main__':

    main()

from collections import defaultdict

# all_split("abc") -> [['abc'], ['ab', 'c'], ['a', 'bc'], ['a', 'b', 'c']]
def all_split(s):
    if len(s) == 1:
        return [s]
    ans = []
    for i in range(2 ** (len(s) - 1)):
        b = list(map(int, format(i, "0" + str(len(s) - 1) + "b")))
        ans.append(split(s, b))
    return ans


def split(s, split_positions):
    assert len(s) - 1 == len(split_positions)
    ans = []
    pre = 0
    for i, is_split in enumerate(split_positions, start=1):
        if is_split:
            ans.append(s[pre:i])
            pre = i
    ans.append(s[pre:])
    return ans


def main():
    s = eval(input())
    ans = 0
    for x in all_split(s):
        ans += eval("+".join(x))
    print(ans)


if __name__ == "__main__":
    main()

from collections import defaultdict


def main():
    S = eval(input())
    ans = 0
    # 2 ^ nの組み合わせの全列挙
    n = len(S) - 1
    for b in range(2**n):
        p_list = [i for i in range(n) if b & 1 << i]
        x, s = [], S[:]
        for p in p_list[::-1]:
            a, s = s[p + 1 :], s[: p + 1]
            x.append(a)
        if s:
            x.append(s)
        ans += eval("+".join(x))
    print(ans)


if __name__ == "__main__":
    main()

- -# all_split("abc") -> [['abc'], ['ab', 'c'], ['a', 'bc'], ['a', 'b', 'c']] -def all_split(s): -    if len(s) == 1: -        return [s] -    ans = [] -    for i in range(2 ** (len(s) - 1)): -        b = list(map(int, format(i, "0" + str(len(s) - 1) + "b"))) -        ans.append(split(s, b)) -    return ans - - -def split(s, split_positions): -    assert len(s) - 1 == len(split_positions) -    ans = [] -    pre = 0 -    for i, is_split in enumerate(split_positions, start=1): -        if is_split: -            ans.append(s[pre:i]) -            pre = i -    ans.append(s[pre:]) -    return ans -    s = eval(input()) +    S = eval(input()) -    for x in all_split(s): +    # 2 ^ nの組み合わせの全列挙 +    n = len(S) - 1 +    for b in range(2**n): +        p_list = [i for i in range(n) if b & 1 << i] +        x, s = [], S[:] +        for p in p_list[::-1]: +            a, s = s[p + 1 :], s[: p + 1] +            x.append(a) +        if s: +            x.append(s)