import collections

import numpy as np

import sys

sys.setrecursionlimit(10000000)

import copy

#N=int(input())

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

l=[]

for i in range(2021):

    l.append(L%2019)

    if L==R:

        break

    L+=1

ans=2019999

for i in range(len(l)):

    for j in range(i+1,len(l)):

        ans=min(l[i]*l[j]%2019,ans)

print(ans)
import collections

import numpy as np

import sys

sys.setrecursionlimit(10000000)

import copy

#N=int(input())

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

if R-L>=2019:

    print((0))

    exit()

else:

    ans=2019999

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

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

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

            if ans==0:

                print(ans)

                exit()

    print(ans)
import collections
import numpy as np
import sys

sys.setrecursionlimit(10000000)
import copy

# N=int(input())
L, R = list(map(int, input().split()))
l = []
for i in range(2021):
    l.append(L % 2019)
    if L == R:
        break
    L += 1
ans = 2019999
for i in range(len(l)):
    for j in range(i + 1, len(l)):
        ans = min(l[i] * l[j] % 2019, ans)
print(ans)

import collections
import numpy as np
import sys

sys.setrecursionlimit(10000000)
import copy

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

-l = [] -for i in range(2021): -    l.append(L % 2019) -    if L == R: -        break -    L += 1 -ans = 2019999 -for i in range(len(l)): -    for j in range(i + 1, len(l)): -        ans = min(l[i] * l[j] % 2019, ans) -print(ans) +if R - L >= 2019: +    print((0)) +    exit() +else: +    ans = 2019999 +    for i in range(L, R + 1): +        for j in range(i + 1, R + 1): +            ans = min(i * j % 2019, ans) +            if ans == 0: +                print(ans) +                exit() +    print(ans)