def main():

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



    ans = float('inf')

    if R-L >= 672:

        ans = 0

        print(ans)

        return

    for i in range(L,R):

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

            ans = min(ans, i*j%2019)

    print(ans)





if __name__ == '__main__':

    main()

def main():

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



    ans = float('inf')

    if R-L >= 672:

        ans = 0

        print(ans)

        return

    for i in range(L,R):

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

            ans = min(ans, i*j%2019)

            if ans == 1:

                print(ans)

                return

    print(ans)





if __name__ == '__main__':

    main()

def main():
    L, R = list(map(int, input().split()))
    ans = float("inf")
    if R - L >= 672:
        ans = 0
        print(ans)
        return
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            ans = min(ans, i * j % 2019)
    print(ans)


if __name__ == "__main__":
    main()

def main():
    L, R = list(map(int, input().split()))
    ans = float("inf")
    if R - L >= 672:
        ans = 0
        print(ans)
        return
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            ans = min(ans, i * j % 2019)
            if ans == 1:
                print(ans)
                return
    print(ans)


if __name__ == "__main__":
    main()

+            if ans == 1: +                print(ans) +                return