import itertools



def spl(s, t):

    lst = list(s)

    for x in reversed(t):

        lst.insert(x, '+')

    return eval(''.join(lst))





def main():

    nums = eval(input())

    length = len(nums)

    total = 0

    for i in range(length):

        for ts in itertools.combinations(list(range(1, length)), i):

            total += spl(nums, ts)

    print(total)



if __name__ == '__main__':

    main()

import itertools



def split(xs, t):

    total = 0

    tmp = []

    for i, x in enumerate(xs):

        if i in t:

            total += int(''.join(tmp))

            tmp = [x]

        else:

            tmp.append(x)

    if tmp:

        total += int(''.join(tmp))

    return total





def main():

    nums = list(eval(input()))

    length = len(nums)

    total = 0

    for i in range(length):

        for t in itertools.combinations(list(range(1, length)), i):

            total += split(nums, t)

    print(total)



if __name__ == '__main__':

    main()

import itertools


def spl(s, t):
    lst = list(s)
    for x in reversed(t):
        lst.insert(x, "+")
    return eval("".join(lst))


def main():
    nums = eval(input())
    length = len(nums)
    total = 0
    for i in range(length):
        for ts in itertools.combinations(list(range(1, length)), i):
            total += spl(nums, ts)
    print(total)


if __name__ == "__main__":
    main()

import itertools


def split(xs, t):
    total = 0
    tmp = []
    for i, x in enumerate(xs):
        if i in t:
            total += int("".join(tmp))
            tmp = [x]
        else:
            tmp.append(x)
    if tmp:
        total += int("".join(tmp))
    return total


def main():
    nums = list(eval(input()))
    length = len(nums)
    total = 0
    for i in range(length):
        for t in itertools.combinations(list(range(1, length)), i):
            total += split(nums, t)
    print(total)


if __name__ == "__main__":
    main()

-def spl(s, t): -    lst = list(s) -    for x in reversed(t): -        lst.insert(x, "+") -    return eval("".join(lst)) +def split(xs, t): +    total = 0 +    tmp = [] +    for i, x in enumerate(xs): +        if i in t: +            total += int("".join(tmp)) +            tmp = [x] +        else: +            tmp.append(x) +    if tmp: +        total += int("".join(tmp)) +    return total -    nums = eval(input()) +    nums = list(eval(input())) -        for ts in itertools.combinations(list(range(1, length)), i): -            total += spl(nums, ts) +        for t in itertools.combinations(list(range(1, length)), i): +            total += split(nums, t)