def main():

    L, R = list(map(int, input().split()))

    # 60 の相異なる素因数は 3, 673 の 2つ

    if L + 672 <= R:

        print((0))

        return

    lst = []

    for i in range(L, R + 1):

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

            if i * j % 2019 == 0:

                print((0))

                return

            lst.append(i * j % 2019)

    print((min(lst)))

    return





main()

def main():

    L, R = list(map(int, input().split()))

    # 60 の相異なる素因数は 3, 673 の 2つ

    if L + 672 <= R:

        print((0))

        return

    lst = []

    for i in range(L, R + 1):

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

            if i * j % 2019 == 0:

                print((0))

                return

            lst.append(i * j % 2019)

            if i * j % 2019 == 1:

                break

        if i * j % 2019 == 1:

            break

    print((min(lst)))

    return





main()

def main():
    L, R = list(map(int, input().split()))
    # 60 の相異なる素因数は 3, 673 の 2つ
    if L + 672 <= R:
        print((0))
        return
    lst = []
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            if i * j % 2019 == 0:
                print((0))
                return
            lst.append(i * j % 2019)
    print((min(lst)))
    return


main()

def main():
    L, R = list(map(int, input().split()))
    # 60 の相異なる素因数は 3, 673 の 2つ
    if L + 672 <= R:
        print((0))
        return
    lst = []
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            if i * j % 2019 == 0:
                print((0))
                return
            lst.append(i * j % 2019)
            if i * j % 2019 == 1:
                break
        if i * j % 2019 == 1:
            break
    print((min(lst)))
    return


main()

+            if i * j % 2019 == 1: +                break +        if i * j % 2019 == 1: +            break