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



result = None

for i in range(l, min(l + 2019 - l % 2019, r - 1) + 1):

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

        mod = i * j % 2019

        if result is None or result > mod:

            result = mod

print(result)

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



result = None

for i in range(l, min(l + 2019 - l % 2019, r - 1) + 1):

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

        mod = i * j % 2019

        if result is None or result > mod:

            result = mod

            if result == 0:

                break

    if result == 0:

        break

print(result)

l, r = list(map(int, input().split()))
result = None
for i in range(l, min(l + 2019 - l % 2019, r - 1) + 1):
    for j in range(i + 1, min(i + 2019, r) + 1):
        mod = i * j % 2019
        if result is None or result > mod:
            result = mod
print(result)

l, r = list(map(int, input().split()))
result = None
for i in range(l, min(l + 2019 - l % 2019, r - 1) + 1):
    for j in range(i + 1, min(i + 2019, r) + 1):
        mod = i * j % 2019
        if result is None or result > mod:
            result = mod
            if result == 0:
                break
    if result == 0:
        break
print(result)

+            if result == 0: +                break +    if result == 0: +        break