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

mod = 2019

ans = mod + 1



if R - L >= 3000 or L == 0:

    print((0))

else:

    for i in range(L, R):

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

            m = ((i%mod) * (j%mod)) % mod

            if m < ans:

                ans = m

    print(ans)

import sys



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

mod = 2019

ans = []

if R-L > 3000:

    print((0))

    sys.exit()

elif R-L <= 3000:

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

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

            tmp = (i * j) % mod

            ans.append(tmp)

print((min(ans)))

L, R = list(map(int, input().split()))
mod = 2019
ans = mod + 1
if R - L >= 3000 or L == 0:
    print((0))
else:
    for i in range(L, R):
        for j in range(i + 1, R + 1):
            m = ((i % mod) * (j % mod)) % mod
            if m < ans:
                ans = m
    print(ans)

import sys

L, R = list(map(int, input().split()))
mod = 2019
ans = []
if R - L > 3000:
    print((0))
    sys.exit()
elif R - L <= 3000:
    for i in range(L, R + 1):
        for j in range(i + 1, R + 1):
            tmp = (i * j) % mod
            ans.append(tmp)
print((min(ans)))

+import sys + -ans = mod + 1 -if R - L >= 3000 or L == 0: +ans = [] +if R - L > 3000: -else: -    for i in range(L, R): +    sys.exit() +elif R - L <= 3000: +    for i in range(L, R + 1): -            m = ((i % mod) * (j % mod)) % mod -            if m < ans: -                ans = m -    print(ans) +            tmp = (i * j) % mod +            ans.append(tmp) +print((min(ans)))