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

ans = 2020



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

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

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



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

R = min(R,L+2019)

ans = 2019



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

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

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



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

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

-ans = 2020 -for i in range(L, min(L + 2019, R)): -    for j in range(L + 1, min(L + 2019, R) + 1): +R = min(R, L + 2019) +ans = 2019 +for i in range(L, R + 1): +    for j in range(i + 1, R + 1):