l, r = list(map(int, input().split()))



ans = 2019

for i in range(l, r):

    for j in range(l+1, r+1):

        tmp = i*j % 2019

        if ans > tmp:

            ans = tmp

        if ans == 0:

            print(ans)

            exit(0)

print(ans)
l, r = list(map(int, input().split()))

ans = 2019

for i in range(l, r):

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

        tmp = i*j % 2019

        if ans > tmp:

            ans = tmp

        if ans == 0:

            print(ans)

            exit(0)

print(ans)
l, r = list(map(int, input().split()))
ans = 2019
for i in range(l, r):
    for j in range(l + 1, r + 1):
        tmp = i * j % 2019
        if ans > tmp:
            ans = tmp
        if ans == 0:
            print(ans)
            exit(0)
print(ans)

l, r = list(map(int, input().split()))
ans = 2019
for i in range(l, r):
    for j in range(i + 1, r + 1):
        tmp = i * j % 2019
        if ans > tmp:
            ans = tmp
        if ans == 0:
            print(ans)
            exit(0)
print(ans)

-    for j in range(l + 1, r + 1): +    for j in range(i + 1, r + 1):