def main():

    S = eval(input())

    N = len(S)

    ans = 0

    for bit in range(1<<(N-1)):

        cur = []

        for i in range(N-1):

            if bit&(1<<i):

                cur.append(i)

        else:

            cur.append(N-1)

        pre = 0

        for c in cur:

            num = int(S[pre:c+1])

            ans += num

            pre = c+1

    print(ans)



if __name__ == '__main__':

    main()
def main():

    S = eval(input())

    N = len(S)

    ans = 0

    for bit in range(1<<(N-1)):

        pre = 0

        for i in range(N-1):

            if bit&(1<<i):

                ans += int(S[pre:i+1])

                pre = i + 1

        else:

            ans += int(S[pre:])

    print(ans)



if __name__ == '__main__':

    main()
def main():
    S = eval(input())
    N = len(S)
    ans = 0
    for bit in range(1 << (N - 1)):
        cur = []
        for i in range(N - 1):
            if bit & (1 << i):
                cur.append(i)
        else:
            cur.append(N - 1)
        pre = 0
        for c in cur:
            num = int(S[pre : c + 1])
            ans += num
            pre = c + 1
    print(ans)


if __name__ == "__main__":
    main()

def main():
    S = eval(input())
    N = len(S)
    ans = 0
    for bit in range(1 << (N - 1)):
        pre = 0
        for i in range(N - 1):
            if bit & (1 << i):
                ans += int(S[pre : i + 1])
                pre = i + 1
        else:
            ans += int(S[pre:])
    print(ans)


if __name__ == "__main__":
    main()

-        cur = [] +        pre = 0 -                cur.append(i) +                ans += int(S[pre : i + 1]) +                pre = i + 1 -            cur.append(N - 1) -        pre = 0 -        for c in cur: -            num = int(S[pre : c + 1]) -            ans += num -            pre = c + 1 +            ans += int(S[pre:])