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

a=2019

r=min(l+a,r)

for i in range(l,r):

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

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

print(a)



from collections import deque

from itertools import accumulate

import sys

sys.setrecursionlimit(10**6)



mo=10**9+7

#n=int(input())

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

r=min(l+2019+10,r)



ans=2018

for i in range(l,r):

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

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

        #print(i,j,(i*j)%2019,ans)





print(ans)



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

from collections import deque
from itertools import accumulate
import sys

sys.setrecursionlimit(10**6)
mo = 10**9 + 7
# n=int(input())
l, r = list(map(int, input().split()))
r = min(l + 2019 + 10, r)
ans = 2018
for i in range(l, r):
    for j in range(l + 1, r + 1):
        ans = min(ans, (i * j) % 2019)
        # print(i,j,(i*j)%2019,ans)
print(ans)

+from collections import deque +from itertools import accumulate +import sys + +sys.setrecursionlimit(10**6) +mo = 10**9 + 7 +# n=int(input()) -a = 2019 -r = min(l + a, r) +r = min(l + 2019 + 10, r) +ans = 2018 -        a = min(a, (i * j) % 2019) -print(a) +        ans = min(ans, (i * j) % 2019) +        # print(i,j,(i*j)%2019,ans) +print(ans)