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

ans=2020

if R-L>=2019:

    ans=0

else:

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

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

            a=(i*j)%2019

            ans=min(ans,a)

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

if R-L>=2019:

    minimum=0

else:

    left,right=L%2019,R%2019

    minimum=2018**2

    for i in range(left,right+1):

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

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

print(minimum)
L, R = list(map(int, input().split()))
ans = 2020
if R - L >= 2019:
    ans = 0
else:
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            a = (i * j) % 2019
            ans = min(ans, a)
print(ans)

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

-ans = 2020 -    ans = 0 +    minimum = 0 -    for i in range(L, R + 1): -        for j in range(i + 1, R + 1): -            a = (i * j) % 2019 -            ans = min(ans, a) -print(ans) +    left, right = L % 2019, R % 2019 +    minimum = 2018**2 +    for i in range(left, right + 1): +        for j in range(i + 1, right + 1): +            minimum = min(minimum, i * j % 2019) +print(minimum)