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

a = float("inf")

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

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

                              if a > (i*j)%2019:

                                 a = (i*j)%2019

print(a)
import sys

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

if r-l>=2019:

    print((0))

    sys.exit()

a=l%2019

b=r%2019

if a>b:

    b+=2019

elif a==b:

    print((0))

    sys.exit()

m=2018

for i in range(a,b):

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

        if m>(i*j)%2019:

            m=(i*j)%2019



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

import sys

l, r = list(map(int, input().split()))
if r - l >= 2019:
    print((0))
    sys.exit()
a = l % 2019
b = r % 2019
if a > b:
    b += 2019
elif a == b:
    print((0))
    sys.exit()
m = 2018
for i in range(a, b):
    for j in range(i + 1, b + 1):
        if m > (i * j) % 2019:
            m = (i * j) % 2019
print(m)

+import sys + -a = float("inf") -for i in range(l, min(r + 1, l + 2019)): -    for j in range(i + 1, min(r + 1, l + 2019)): -        if a > (i * j) % 2019: -            a = (i * j) % 2019 -print(a) +if r - l >= 2019: +    print((0)) +    sys.exit() +a = l % 2019 +b = r % 2019 +if a > b: +    b += 2019 +elif a == b: +    print((0)) +    sys.exit() +m = 2018 +for i in range(a, b): +    for j in range(i + 1, b + 1): +        if m > (i * j) % 2019: +            m = (i * j) % 2019 +print(m)