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



MOD = 2019

ub = max(R % MOD, L % MOD)

lb = min(R % MOD, L % MOD)



if ub == lb or R // MOD != L // MOD:

    print((0))

    exit()



ans = float('inf')

for i in range(lb, ub + 1):

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

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

print(ans)
L, R = list(map(int, open(0).read().split()))



ans = 2020

m = min(L + 2020, R) + 1

for i in range(L, m):

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

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



print(ans)

L, R = list(map(int, input().split()))
MOD = 2019
ub = max(R % MOD, L % MOD)
lb = min(R % MOD, L % MOD)
if ub == lb or R // MOD != L // MOD:
    print((0))
    exit()
ans = float("inf")
for i in range(lb, ub + 1):
    for j in range(i + 1, ub + 1):
        ans = min(ans, i * j % MOD)
print(ans)

L, R = list(map(int, open(0).read().split()))
ans = 2020
m = min(L + 2020, R) + 1
for i in range(L, m):
    for j in range(i + 1, m):
        ans = min(ans, i * j % 2019)
print(ans)

-L, R = list(map(int, input().split())) -MOD = 2019 -ub = max(R % MOD, L % MOD) -lb = min(R % MOD, L % MOD) -if ub == lb or R // MOD != L // MOD: -    print((0)) -    exit() -ans = float("inf") -for i in range(lb, ub + 1): -    for j in range(i + 1, ub + 1): -        ans = min(ans, i * j % MOD) +L, R = list(map(int, open(0).read().split())) +ans = 2020 +m = min(L + 2020, R) + 1 +for i in range(L, m): +    for j in range(i + 1, m): +        ans = min(ans, i * j % 2019)