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

ans=[]

if (R-L)>2019:

    print((0))

else:

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

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

            ans.append(m*j%2019)

    print((min(ans)))

            

            

import sys

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

ans=[]

if (R-L)>2019:

    print((0))

else:

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

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

            ans.append(m*j%2019)

            if m*j%2019==0:

              print((0))

              sys.exit()

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

import sys

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

+import sys + +            if m * j % 2019 == 0: +                print((0)) +                sys.exit()