def main():

    s = eval(input())

    n = len(s)

    ans = 0

    for i in range(n + 1):

        for j in range(i + 1, n + 1):

            x = int(s[i:j])

            p = 2 ** max(0, i - 1)

            q = 2 ** max(0, n - j - 1)

            ans += x * p * q



    print(ans)



if __name__ == '__main__':

    main()

def main():

    s = str(eval(input()))

    n = len(s)

    ans = 0

    for i in range(n + 1):

        for j in range(i + 1, n + 1):

            x = int(s[i:j])

            p = 2 ** max(0, i - 1)

            q = 2 ** max(0, n - j - 1)

            ans += x * p * q



    print(ans)



if __name__ == '__main__':

    main()

def main():
    s = eval(input())
    n = len(s)
    ans = 0
    for i in range(n + 1):
        for j in range(i + 1, n + 1):
            x = int(s[i:j])
            p = 2 ** max(0, i - 1)
            q = 2 ** max(0, n - j - 1)
            ans += x * p * q
    print(ans)


if __name__ == "__main__":
    main()

def main():
    s = str(eval(input()))
    n = len(s)
    ans = 0
    for i in range(n + 1):
        for j in range(i + 1, n + 1):
            x = int(s[i:j])
            p = 2 ** max(0, i - 1)
            q = 2 ** max(0, n - j - 1)
            ans += x * p * q
    print(ans)


if __name__ == "__main__":
    main()

-    s = eval(input()) +    s = str(eval(input()))