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):

            m = i * j % 2019

            lst.append(m)

            if m == 0:

                break

        if m == 0:

            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

    print((min(i * j % 2019 for i in range(L, R + 1)

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

    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):
            m = i * j % 2019
            lst.append(m)
            if m == 0:
                break
        if m == 0:
            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
    print((min(i * j % 2019 for i in range(L, R + 1) for j in range(i + 1, R + 1))))
    return


main()

-    lst = [] -    for i in range(L, R + 1): -        for j in range(i + 1, R + 1): -            m = i * j % 2019 -            lst.append(m) -            if m == 0: -                break -        if m == 0: -            break -    print((min(lst))) +    print((min(i * j % 2019 for i in range(L, R + 1) for j in range(i + 1, R + 1))))