import sys

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



if R-L>2017:

  print((0))

  sys.exit()



L%=2019

while(R-L>2019):

  R-=2019

  

#print(L,R)

answer=10**10

for i in range(L,R):

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

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

    

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



if L//2019 != R//2019:

  print((0))

else:

  L%=2019

  R%=2019

  

  answer=10**10

  for i in range(L,R):

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

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

      

  print(answer)
import sys

L, R = list(map(int, input().split()))
if R - L > 2017:
    print((0))
    sys.exit()
L %= 2019
while R - L > 2019:
    R -= 2019
# print(L,R)
answer = 10**10
for i in range(L, R):
    for j in range(i + 1, R + 1):
        answer = min(answer, (i * j) % 2019)
print(answer)

L, R = list(map(int, input().split()))
if L // 2019 != R // 2019:
    print((0))
else:
    L %= 2019
    R %= 2019
    answer = 10**10
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            answer = min(answer, (i * j) % 2019)
    print(answer)

-import sys - -if R - L > 2017: +if L // 2019 != R // 2019: -    sys.exit() -L %= 2019 -while R - L > 2019: -    R -= 2019 -# print(L,R) -answer = 10**10 -for i in range(L, R): -    for j in range(i + 1, R + 1): -        answer = min(answer, (i * j) % 2019) -print(answer) +else: +    L %= 2019 +    R %= 2019 +    answer = 10**10 +    for i in range(L, R): +        for j in range(i + 1, R + 1): +            answer = min(answer, (i * j) % 2019) +    print(answer)