import sys

from itertools import combinations



s = list(sys.stdin.readline().rstrip())

l = len(s)



def main():

    res = 0

    cand = list(range(1, l))

    for inser_cnt in range(l):

        for idces in combinations(cand, inser_cnt):

            t = s.copy()

            idces = list(idces)

            for i in idces[::-1]:

                t.insert(i, '+')

            res += eval(''.join(t))

            

    return res

                     

if __name__ == '__main__':

    ans = main()

    print(ans)
import sys



s = sys.stdin.readline().rstrip()

n = len(s)



def c(n):

    return pow(2, max(0, n - 1))

  

def main():

    res = 0

    for l in range(n):

        for r in range(l, n):

            res += int(s[l:r+1]) * c(l) * c(n - 1 - r)

    print(res)



if __name__ ==  '__main__':

    main()
import sys
from itertools import combinations

s = list(sys.stdin.readline().rstrip())
l = len(s)


def main():
    res = 0
    cand = list(range(1, l))
    for inser_cnt in range(l):
        for idces in combinations(cand, inser_cnt):
            t = s.copy()
            idces = list(idces)
            for i in idces[::-1]:
                t.insert(i, "+")
            res += eval("".join(t))
    return res


if __name__ == "__main__":
    ans = main()
    print(ans)

import sys

s = sys.stdin.readline().rstrip()
n = len(s)


def c(n):
    return pow(2, max(0, n - 1))


def main():
    res = 0
    for l in range(n):
        for r in range(l, n):
            res += int(s[l : r + 1]) * c(l) * c(n - 1 - r)
    print(res)


if __name__ == "__main__":
    main()

-from itertools import combinations -s = list(sys.stdin.readline().rstrip()) -l = len(s) +s = sys.stdin.readline().rstrip() +n = len(s) + + +def c(n): +    return pow(2, max(0, n - 1)) -    cand = list(range(1, l)) -    for inser_cnt in range(l): -        for idces in combinations(cand, inser_cnt): -            t = s.copy() -            idces = list(idces) -            for i in idces[::-1]: -                t.insert(i, "+") -            res += eval("".join(t)) -    return res +    for l in range(n): +        for r in range(l, n): +            res += int(s[l : r + 1]) * c(l) * c(n - 1 - r) +    print(res) -    ans = main() -    print(ans) +    main()