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

ans = 2018

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

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

        ans = min(ans, (x*y)%2019)

print(ans)

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

ans = 2018

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

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

        ans = min(ans, (x*y)%2019)

        if ans == 0:

            print((0))

            quit()

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

L, R = list(map(int, input().split()))
ans = 2018
for x in range(L, min(R, L + 2019)):
    for y in range(L + 1, min(R + 1, L + 2019)):
        ans = min(ans, (x * y) % 2019)
        if ans == 0:
            print((0))
            quit()
print(ans)

+        if ans == 0: +            print((0)) +            quit()