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



ans = 2018



for i in range(L,min(R,L+2100)):

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

        if (i*j) % 2019 <= ans:

            ans = (i*j) % 2019



print(ans)
#! python3

#  solve_133C.py



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



ans = 3000



for i in range(L,min(R,L+2019)):

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

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

        

print(ans)
L, R = list(map(int, input().split()))
ans = 2018
for i in range(L, min(R, L + 2100)):
    for j in range(i + 1, min(R + 1, i + 2100)):
        if (i * j) % 2019 <= ans:
            ans = (i * j) % 2019
print(ans)

#! python3
#  solve_133C.py
L, R = list(map(int, input().split()))
ans = 3000
for i in range(L, min(R, L + 2019)):
    for j in range(i + 1, min(R + 1, L + 2019)):
        ans = min(ans, i * j % 2019)
print(ans)

+#! python3 +#  solve_133C.py -ans = 2018 -for i in range(L, min(R, L + 2100)): -    for j in range(i + 1, min(R + 1, i + 2100)): -        if (i * j) % 2019 <= ans: -            ans = (i * j) % 2019 +ans = 3000 +for i in range(L, min(R, L + 2019)): +    for j in range(i + 1, min(R + 1, L + 2019)): +        ans = min(ans, i * j % 2019)