import sys

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

anslist=20000000000

for i in range(l,r):

    if r-i>=(2019-i%2019):

        print((0))

        sys.exit()

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

        ans=min(anslist,i*u%2019)

        anslist=ans

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

def mod2019(x, y):

    ans=2019

    for i in range(x, y):

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

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

    return ans



if r - l >= 2019:

    print((0))

else:

    print((mod2019(l,r)))

import sys

l, r = list(map(int, input().split()))
anslist = 20000000000
for i in range(l, r):
    if r - i >= (2019 - i % 2019):
        print((0))
        sys.exit()
    for u in range(i + 1, r + 1):
        ans = min(anslist, i * u % 2019)
        anslist = ans
print(ans)

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


def mod2019(x, y):
    ans = 2019
    for i in range(x, y):
        for j in range(i + 1, y + 1):
            ans = min(ans, i * j % 2019)
    return ans


if r - l >= 2019:
    print((0))
else:
    print((mod2019(l, r)))

-import sys +l, r = list(map(int, input().split())) -l, r = list(map(int, input().split())) -anslist = 20000000000 -for i in range(l, r): -    if r - i >= (2019 - i % 2019): -        print((0)) -        sys.exit() -    for u in range(i + 1, r + 1): -        ans = min(anslist, i * u % 2019) -        anslist = ans -print(ans) + +def mod2019(x, y): +    ans = 2019 +    for i in range(x, y): +        for j in range(i + 1, y + 1): +            ans = min(ans, i * j % 2019) +    return ans + + +if r - l >= 2019: +    print((0)) +else: +    print((mod2019(l, r)))