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

if R-L>=2019:

    minimum=0

else:

    left,right=L%2019,R%2019

    minimum=2018**2

    for i in range(left,right+1):

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

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

print(minimum)
import itertools

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



if R-L>=2019:

    print((0))

    exit()

b = 2018

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

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

        a = (i*j)%2019

        b = min(b,a)

        if b == 0:

            break

print(b)
L, R = list(map(int, input().split()))
if R - L >= 2019:
    minimum = 0
else:
    left, right = L % 2019, R % 2019
    minimum = 2018**2
    for i in range(left, right + 1):
        for j in range(i + 1, right + 1):
            minimum = min(minimum, i * j % 2019)
print(minimum)

import itertools

L, R = list(map(int, input().split()))
if R - L >= 2019:
    print((0))
    exit()
b = 2018
for i in range(L, R + 1):
    for j in range(i + 1, R + 1):
        a = (i * j) % 2019
        b = min(b, a)
        if b == 0:
            break
print(b)

+import itertools + -    minimum = 0 -else: -    left, right = L % 2019, R % 2019 -    minimum = 2018**2 -    for i in range(left, right + 1): -        for j in range(i + 1, right + 1): -            minimum = min(minimum, i * j % 2019) -print(minimum) +    print((0)) +    exit() +b = 2018 +for i in range(L, R + 1): +    for j in range(i + 1, R + 1): +        a = (i * j) % 2019 +        b = min(b, a) +        if b == 0: +            break +print(b)