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

a=[]

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

    a.append(i%2019)

a=sorted(a)

ans=2020

for i in range(len(a)-1):

    for j in range(1,len(a)):

        ans=min(ans,a[i]*a[j]%2019)

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

ans=10**10

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

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

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

print(ans)
l, r = list(map(int, input().split()))
a = []
for i in range(l, min(r + 1, l + 2020)):
    a.append(i % 2019)
a = sorted(a)
ans = 2020
for i in range(len(a) - 1):
    for j in range(1, len(a)):
        ans = min(ans, a[i] * a[j] % 2019)
print(ans)

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

-a = [] -for i in range(l, min(r + 1, l + 2020)): -    a.append(i % 2019) -a = sorted(a) -ans = 2020 -for i in range(len(a) - 1): -    for j in range(1, len(a)): -        ans = min(ans, a[i] * a[j] % 2019) +ans = 10**10 +for i in range(l, min(r, l + 2019)): +    for j in range(i + 1, min(r, l + 2019) + 1): +        ans = min(ans, i * j % 2019)