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

mod = 2019

ans = 10**9 + 7

for i in range(L, min(L + mod, R)):

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

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

print(ans)

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

mod = 2019

ans = 10**9

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

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

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

print(ans)

L, R = list(map(int, input().split()))
mod = 2019
ans = 10**9 + 7
for i in range(L, min(L + mod, R)):
    for j in range(i + 1, min(i + mod + 1, R + 1)):
        ans = min((i * j) % mod, ans)
print(ans)

L, R = list(map(int, input().split()))
mod = 2019
ans = 10**9
for i in range(L, min(R + 1, L + 2030)):
    for j in range(i + 1, min(R + 1, L + 2030)):
        ans = min(ans, (i * j) % mod)
print(ans)

-ans = 10**9 + 7 -for i in range(L, min(L + mod, R)): -    for j in range(i + 1, min(i + mod + 1, R + 1)): -        ans = min((i * j) % mod, ans) +ans = 10**9 +for i in range(L, min(R + 1, L + 2030)): +    for j in range(i + 1, min(R + 1, L + 2030)): +        ans = min(ans, (i * j) % mod)