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



if r - l >= 2019:

  print((0))

  exit()



ans = 10**9

for i in range(l,r):

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

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

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



if r-l >= 2019:

  print((0))

  exit()



ans = float("inf")

for i in range(l,r):

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

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

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

l, r = list(map(int, input().split()))
if r - l >= 2019:
    print((0))
    exit()
ans = float("inf")
for i in range(l, r):
    for j in range(i + 1, r + 1):
        if i * j % 2019 < ans:
            ans = i * j % 2019
print(ans)

-ans = 10**9 +ans = float("inf") -        ans = min(ans, i * j % 2019) +        if i * j % 2019 < ans: +            ans = i * j % 2019