from itertools import zip_longest



s = eval(input())

s = list(s)

cnt_pos = len(s) - 1#記号の入り得る位置の数

formula_cnt = 2 ** (cnt_pos)#式数



ans = 0

for i in range(formula_cnt):

    sgns = ['+' if (i & (2 ** x) != 0) else '' for x in range(cnt_pos)]

    formula = ''

    for c, sgn in zip_longest(s, sgns, fillvalue=''):

        formula += c + sgn

    #print(i, s, sgns, formula)

    ans += eval(formula)

print(ans)

def main():

    import sys

    sys.setrecursionlimit(10 ** 7)



    s = eval(input())



    def calc(cur=1, t=s[0]):

        if cur == len(s):

            return eval(t)

        return calc(cur + 1, t + s[cur]) + calc(cur + 1, t + '+' + s[cur])



    print((calc()))





if __name__ == '__main__':

    main()

from itertools import zip_longest

s = eval(input())
s = list(s)
cnt_pos = len(s) - 1  # 記号の入り得る位置の数
formula_cnt = 2 ** (cnt_pos)  # 式数
ans = 0
for i in range(formula_cnt):
    sgns = ["+" if (i & (2**x) != 0) else "" for x in range(cnt_pos)]
    formula = ""
    for c, sgn in zip_longest(s, sgns, fillvalue=""):
        formula += c + sgn
    # print(i, s, sgns, formula)
    ans += eval(formula)
print(ans)

def main():
    import sys

    sys.setrecursionlimit(10**7)
    s = eval(input())

    def calc(cur=1, t=s[0]):
        if cur == len(s):
            return eval(t)
        return calc(cur + 1, t + s[cur]) + calc(cur + 1, t + "+" + s[cur])

    print((calc()))


if __name__ == "__main__":
    main()

-from itertools import zip_longest +def main(): +    import sys -s = eval(input()) -s = list(s) -cnt_pos = len(s) - 1  # 記号の入り得る位置の数 -formula_cnt = 2 ** (cnt_pos)  # 式数 -ans = 0 -for i in range(formula_cnt): -    sgns = ["+" if (i & (2**x) != 0) else "" for x in range(cnt_pos)] -    formula = "" -    for c, sgn in zip_longest(s, sgns, fillvalue=""): -        formula += c + sgn -    # print(i, s, sgns, formula) -    ans += eval(formula) -print(ans) +    sys.setrecursionlimit(10**7) +    s = eval(input()) + +    def calc(cur=1, t=s[0]): +        if cur == len(s): +            return eval(t) +        return calc(cur + 1, t + s[cur]) + calc(cur + 1, t + "+" + s[cur]) + +    print((calc())) + + +if __name__ == "__main__": +    main()