import sys

L,R=[int(x) for x in input().strip().split()]



tmp=10**9+1

ans=10**9+1



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

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

    if i<j:

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

  

      if ans==0:

        print((0))

        sys.exit()

print(ans)





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

import sys

mod=2019

ans=float('inf')



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

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

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

    if ans==0:

      print((0))

      sys.exit()

print(ans)
import sys

L, R = [int(x) for x in input().strip().split()]
tmp = 10**9 + 1
ans = 10**9 + 1
for i in range(L, R, 1):
    for j in range(L + 1, R + 1, 1):
        if i < j:
            ans = min((i * j) % 2019, ans)
            if ans == 0:
                print((0))
                sys.exit()
print(ans)
# 332701087 1753412895

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

mod = 2019
ans = float("inf")
for i in range(l, r + 1):
    for j in range(i + 1, r + 1):
        ans = min((i * j) % mod, ans)
        if ans == 0:
            print((0))
            sys.exit()
print(ans)

+l, r = list(map(int, input().split())) -L, R = [int(x) for x in input().strip().split()] -tmp = 10**9 + 1 -ans = 10**9 + 1 -for i in range(L, R, 1): -    for j in range(L + 1, R + 1, 1): -        if i < j: -            ans = min((i * j) % 2019, ans) -            if ans == 0: -                print((0)) -                sys.exit() +mod = 2019 +ans = float("inf") +for i in range(l, r + 1): +    for j in range(i + 1, r + 1): +        ans = min((i * j) % mod, ans) +        if ans == 0: +            print((0)) +            sys.exit() -# 332701087 1753412895