from sys import exit

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

res=1000000000000

if r-l>2020:

	print("0")

	exit()

else:

	for i in range(l%2019,r%2019):

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

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

print(res)
from sys import exit

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

res=10000000000000

for i in range(l,r):

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

		a=(i*j)%2019

		if a==0:

			print("0")

			exit()

		else:

			res=min(res,a)

print(res)
from sys import exit

l, r = list(map(int, input().split()))
res = 1000000000000
if r - l > 2020:
    print("0")
    exit()
else:
    for i in range(l % 2019, r % 2019):
        for j in range(i + 1, r % 2019 + 1):
            res = min(res, (i * j) % 2019)
print(res)

from sys import exit

l, r = list(map(int, input().split()))
res = 10000000000000
for i in range(l, r):
    for j in range(i + 1, r + 1):
        a = (i * j) % 2019
        if a == 0:
            print("0")
            exit()
        else:
            res = min(res, a)
print(res)

-res = 1000000000000 -if r - l > 2020: -    print("0") -    exit() -else: -    for i in range(l % 2019, r % 2019): -        for j in range(i + 1, r % 2019 + 1): -            res = min(res, (i * j) % 2019) +res = 10000000000000 +for i in range(l, r): +    for j in range(i + 1, r + 1): +        a = (i * j) % 2019 +        if a == 0: +            print("0") +            exit() +        else: +            res = min(res, a)