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



if R - L >= 2019:

    ans = 0

else:

    ans = 2019

    for i in range(L, R):

        x = i % 2019

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

            a = x * j

            ans = min(a % 2019, ans)



print(ans)

import numpy as np



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



if R - L >= 2019:

    ans = 0

else:

    A = np.arange(L, R + 1) % 2019

    B = A.reshape(1, -1)

    C = (A.reshape(-1, 1) * B) % 2019

    r = np.arange(len(A))

    C[r, r] = 2019

    ans = np.min(C)



print(ans)

L, R = list(map(int, input().split()))
if R - L >= 2019:
    ans = 0
else:
    ans = 2019
    for i in range(L, R):
        x = i % 2019
        for j in range(i + 1, R + 1):
            a = x * j
            ans = min(a % 2019, ans)
print(ans)

import numpy as np

L, R = list(map(int, input().split()))
if R - L >= 2019:
    ans = 0
else:
    A = np.arange(L, R + 1) % 2019
    B = A.reshape(1, -1)
    C = (A.reshape(-1, 1) * B) % 2019
    r = np.arange(len(A))
    C[r, r] = 2019
    ans = np.min(C)
print(ans)

+import numpy as np + -    ans = 2019 -    for i in range(L, R): -        x = i % 2019 -        for j in range(i + 1, R + 1): -            a = x * j -            ans = min(a % 2019, ans) +    A = np.arange(L, R + 1) % 2019 +    B = A.reshape(1, -1) +    C = (A.reshape(-1, 1) * B) % 2019 +    r = np.arange(len(A)) +    C[r, r] = 2019 +    ans = np.min(C)