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



minimum = L * R

for i in range(L, min(R, L+2020)):

    for j in range(i+1, min(R+1, i+2021)):

        

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

        



print(minimum)
import sys



sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))



MOD = 2019

L, R = lr()

if (R-L) > 2019 * 2:

    R = L + (R-L)%MOD + 2019



answer = 2019

for i in range(L, R):

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

        temp = i * j % MOD

        if temp < answer:

            answer = temp



print(answer)
L, R = list(map(int, input().split()))
minimum = L * R
for i in range(L, min(R, L + 2020)):
    for j in range(i + 1, min(R + 1, i + 2021)):
        minimum = min(minimum, i * j % 2019)
print(minimum)

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
MOD = 2019
L, R = lr()
if (R - L) > 2019 * 2:
    R = L + (R - L) % MOD + 2019
answer = 2019
for i in range(L, R):
    for j in range(i + 1, R + 1):
        temp = i * j % MOD
        if temp < answer:
            answer = temp
print(answer)

-L, R = list(map(int, input().split())) -minimum = L * R -for i in range(L, min(R, L + 2020)): -    for j in range(i + 1, min(R + 1, i + 2021)): -        minimum = min(minimum, i * j % 2019) -print(minimum) +import sys + +sr = lambda: sys.stdin.readline().rstrip() +ir = lambda: int(sr()) +lr = lambda: list(map(int, sr().split())) +MOD = 2019 +L, R = lr() +if (R - L) > 2019 * 2: +    R = L + (R - L) % MOD + 2019 +answer = 2019 +for i in range(L, R): +    for j in range(i + 1, R + 1): +        temp = i * j % MOD +        if temp < answer: +            answer = temp +print(answer)