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

flg = 1

for i in range(10**6+1) :

    if 2019*i < L :

        continue

    

    if 2019*i <= R :

        ans = 0

        flg = 0

        break

    

    else :

        break

if flg :

    ans = float("inf")

    

    for i in range(L,R) :

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

            calc = (i*j) % 2019

            ans = min(ans,calc)

print(ans)

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

if R-L >= 2018 :

    ans = 0

else :

    ans = float("inf")

    for i in range(L,R) :

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

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

print(ans)
L, R = list(map(int, input().split()))
flg = 1
for i in range(10**6 + 1):
    if 2019 * i < L:
        continue
    if 2019 * i <= R:
        ans = 0
        flg = 0
        break
    else:
        break
if flg:
    ans = float("inf")
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            calc = (i * j) % 2019
            ans = min(ans, calc)
print(ans)

L, R = list(map(int, input().split()))
if R - L >= 2018:
    ans = 0
else:
    ans = float("inf")
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            ans = min(ans, (i * j) % 2019)
print(ans)

-flg = 1 -for i in range(10**6 + 1): -    if 2019 * i < L: -        continue -    if 2019 * i <= R: -        ans = 0 -        flg = 0 -        break -    else: -        break -if flg: +if R - L >= 2018: +    ans = 0 +else: -            calc = (i * j) % 2019 -            ans = min(ans, calc) +            ans = min(ans, (i * j) % 2019)