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

ans = 10000

for i in range(l, min(r, l + 2030)):

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

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

print(ans)

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

ans = 10000

for i in range(l, min(r, l + 2030)):

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

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

        if ans == 0:

            print(ans)

            exit()

print(ans)

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

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

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