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

R -= (L // 2019) * 2019

L %= 2019



while R-4038 > L:

  R -= 2019



ans = float('inf')

for i in range(L, R):

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

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



print(ans)
def abc133_c():

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

  if R - L > 673: return 0

  ans = 2019

  for i in range(L, R):

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

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

      if ans == 1: return 1

  return ans



print((abc133_c()))
L, R = list(map(int, input().split()))
R -= (L // 2019) * 2019
L %= 2019
while R - 4038 > L:
    R -= 2019
ans = float("inf")
for i in range(L, R):
    for j in range(i + 1, R + 1):
        ans = min(ans, i * j % 2019)
print(ans)

def abc133_c():
    L, R = list(map(int, input().split()))
    if R - L > 673:
        return 0
    ans = 2019
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            ans = min(ans, i * j % 2019)
            if ans == 1:
                return 1
    return ans


print((abc133_c()))

-L, R = list(map(int, input().split())) -R -= (L // 2019) * 2019 -L %= 2019 -while R - 4038 > L: -    R -= 2019 -ans = float("inf") -for i in range(L, R): -    for j in range(i + 1, R + 1): -        ans = min(ans, i * j % 2019) -print(ans) +def abc133_c(): +    L, R = list(map(int, input().split())) +    if R - L > 673: +        return 0 +    ans = 2019 +    for i in range(L, R): +        for j in range(i + 1, R + 1): +            ans = min(ans, i * j % 2019) +            if ans == 1: +                return 1 +    return ans + + +print((abc133_c()))