import sys

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

mod = 2019

cnt = 0

ans = float('inf')

List = [False for i in range(2019)]

for i in range(L,R):

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

        tmp = (i*j)%mod

        List[tmp] = True

        ans = min(tmp,L*R,ans)

        if cnt>=10**6 or all(List)==True:

            print(ans)

            sys.exit()

        cnt +=1

print(ans)
def main():

    mod = 2019

    l,r = list(map(int,input().split()))

    ans = 10**9

    for i in range(l,min(l+2020,r+1)):

        for j in range(i+1,min(l+2020,r+1)):

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

    print(ans)

main()
import sys

L, R = list(map(int, input().split()))
mod = 2019
cnt = 0
ans = float("inf")
List = [False for i in range(2019)]
for i in range(L, R):
    for j in range(i + 1, R + 1):
        tmp = (i * j) % mod
        List[tmp] = True
        ans = min(tmp, L * R, ans)
        if cnt >= 10**6 or all(List) == True:
            print(ans)
            sys.exit()
        cnt += 1
print(ans)

def main():
    mod = 2019
    l, r = list(map(int, input().split()))
    ans = 10**9
    for i in range(l, min(l + 2020, r + 1)):
        for j in range(i + 1, min(l + 2020, r + 1)):
            ans = min(ans, (i * j) % mod)
    print(ans)


main()

-import sys +def main(): +    mod = 2019 +    l, r = list(map(int, input().split())) +    ans = 10**9 +    for i in range(l, min(l + 2020, r + 1)): +        for j in range(i + 1, min(l + 2020, r + 1)): +            ans = min(ans, (i * j) % mod) +    print(ans) -L, R = list(map(int, input().split())) -mod = 2019 -cnt = 0 -ans = float("inf") -List = [False for i in range(2019)] -for i in range(L, R): -    for j in range(i + 1, R + 1): -        tmp = (i * j) % mod -        List[tmp] = True -        ans = min(tmp, L * R, ans) -        if cnt >= 10**6 or all(List) == True: -            print(ans) -            sys.exit() -        cnt += 1 -print(ans) + +main()