# +2019までを調べれば十分



l, r = list(map(int, input().split()))

ans = 10**9



for i in range(l, min(r+1, l+2020)):

  for j in range(i,  min(r+1, l+2020)):

    if i < j:

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



print(ans)
l, r = list(map(int, input().split()))

if r - l >= 2019:

    print((0))

    exit()

ans = 2019



for i in range(l, r + 1):

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

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

print(ans)
# +2019までを調べれば十分
l, r = list(map(int, input().split()))
ans = 10**9
for i in range(l, min(r + 1, l + 2020)):
    for j in range(i, min(r + 1, l + 2020)):
        if i < j:
            ans = min(ans, (i * j) % 2019)
print(ans)

l, r = list(map(int, input().split()))
if r - l >= 2019:
    print((0))
    exit()
ans = 2019
for i in range(l, r + 1):
    for j in range(i + 1, r + 1):
        ans = min(ans, (i * j) % 2019)
print(ans)

-# +2019までを調べれば十分 -ans = 10**9 -for i in range(l, min(r + 1, l + 2020)): -    for j in range(i, min(r + 1, l + 2020)): -        if i < j: -            ans = min(ans, (i * j) % 2019) +if r - l >= 2019: +    print((0)) +    exit() +ans = 2019 +for i in range(l, r + 1): +    for j in range(i + 1, r + 1): +        ans = min(ans, (i * j) % 2019)