l, r = [int(x) for x in input().split()]



if r - l >= 2019:

    skip_flag = [False] * 2019

else:

    a = l % 2019

    temp = r % 2019

    b = temp if temp > a else temp + 2019

    skip_flag = [True] * 2019

    for i in range(a, b + 1):

        skip_flag[i % 2019] = False



if not skip_flag[0]:

    print((0))

    exit()



ans = 2019

for i in range(1, 2019):

    if skip_flag[i]:

        continue

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

        if skip_flag[j]:

            continue

        

        temp = (i * j) % 2019

        if temp < ans:

            ans = temp

print(ans)
l, r = [int(x) for x in input().split()]



if r - l >= 2019:

    a = 0

    b = 2019

else:

    a = l % 2019

    temp = r % 2019

    b = temp if a < temp else temp + 2019



ans = 2019

for i in range(a, b):

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

        temp = (i * j) % 2019

        if temp < ans:

            ans = temp

            if ans == 0:

                print((0))

                exit()

print(ans)
l, r = [int(x) for x in input().split()]
if r - l >= 2019:
    skip_flag = [False] * 2019
else:
    a = l % 2019
    temp = r % 2019
    b = temp if temp > a else temp + 2019
    skip_flag = [True] * 2019
    for i in range(a, b + 1):
        skip_flag[i % 2019] = False
if not skip_flag[0]:
    print((0))
    exit()
ans = 2019
for i in range(1, 2019):
    if skip_flag[i]:
        continue
    for j in range(i + 1, 2019):
        if skip_flag[j]:
            continue
        temp = (i * j) % 2019
        if temp < ans:
            ans = temp
print(ans)

l, r = [int(x) for x in input().split()]
if r - l >= 2019:
    a = 0
    b = 2019
else:
    a = l % 2019
    temp = r % 2019
    b = temp if a < temp else temp + 2019
ans = 2019
for i in range(a, b):
    for j in range(i + 1, b + 1):
        temp = (i * j) % 2019
        if temp < ans:
            ans = temp
            if ans == 0:
                print((0))
                exit()
print(ans)

-    skip_flag = [False] * 2019 +    a = 0 +    b = 2019 -    b = temp if temp > a else temp + 2019 -    skip_flag = [True] * 2019 -    for i in range(a, b + 1): -        skip_flag[i % 2019] = False -if not skip_flag[0]: -    print((0)) -    exit() +    b = temp if a < temp else temp + 2019 -for i in range(1, 2019): -    if skip_flag[i]: -        continue -    for j in range(i + 1, 2019): -        if skip_flag[j]: -            continue +for i in range(a, b): +    for j in range(i + 1, b + 1): +            if ans == 0: +                print((0)) +                exit()