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

mod = 2019



ans = 2019

if R - L >= 2019:

  print((0))

else:

  for i in range(L, R):

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

      val = ((i%mod) * (j%mod))%mod

      ans = min(ans, val)

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



tmp = float("INF")

ans = tmp

for i in range(L, R):

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

    tmp = (i % 2019) * (j % 2019) % 2019

    ans = min(ans, tmp)

    if ans == 0:

      print((0))

      exit()

      

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

L, R = list(map(int, input().split()))
tmp = float("INF")
ans = tmp
for i in range(L, R):
    for j in range(i + 1, R + 1):
        tmp = (i % 2019) * (j % 2019) % 2019
        ans = min(ans, tmp)
        if ans == 0:
            print((0))
            exit()
print(ans)

-mod = 2019 -ans = 2019 -if R - L >= 2019: -    print((0)) -else: -    for i in range(L, R): -        for j in range(i + 1, R + 1): -            val = ((i % mod) * (j % mod)) % mod -            ans = min(ans, val) -    print(ans) +tmp = float("INF") +ans = tmp +for i in range(L, R): +    for j in range(i + 1, R + 1): +        tmp = (i % 2019) * (j % 2019) % 2019 +        ans = min(ans, tmp) +        if ans == 0: +            print((0)) +            exit() +print(ans)