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

if R - L >= 2019:

    mn = 0

else:

    l, r = L % 2019, R % 2019

    mn = 2018 ** 2

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

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

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

print(mn)
from itertools import combinations



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



ans = 2020

if r - l >= 2019:

    ans = 0

else:

    for i, j in list(combinations(list(range(l, r+1)), 2)):

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



print(ans)        
L, R = list(map(int, input().split()))
if R - L >= 2019:
    mn = 0
else:
    l, r = L % 2019, R % 2019
    mn = 2018**2
    for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
            mn = min(mn, i * j % 2019)
print(mn)

from itertools import combinations

l, r = list(map(int, input().split()))
ans = 2020
if r - l >= 2019:
    ans = 0
else:
    for i, j in list(combinations(list(range(l, r + 1)), 2)):
        ans = min(ans, (i * j) % 2019)
print(ans)

-L, R = list(map(int, input().split())) -if R - L >= 2019: -    mn = 0 +from itertools import combinations + +l, r = list(map(int, input().split())) +ans = 2020 +if r - l >= 2019: +    ans = 0 -    l, r = L % 2019, R % 2019 -    mn = 2018**2 -    for i in range(l, r + 1): -        for j in range(i + 1, r + 1): -            mn = min(mn, i * j % 2019) -print(mn) +    for i, j in list(combinations(list(range(l, r + 1)), 2)): +        ans = min(ans, (i * j) % 2019) +print(ans)