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



mod=2019

ans=mod



l=L%mod

r=R%mod

if r<=l:

    ans=0

elif (R-L)>=2019:

    ans=0

else:

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

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

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

print(ans)
import sys

input = sys.stdin.readline



def I(): return int(eval(input()))

def MI(): return list(map(int, input().split()))

def LI(): return list(map(int, input().split()))



def main():

    mod=2019

    L,R=MI()

    

    if R-L>=2019:

        print((0))

        exit()

    a=L%mod

    b=R%mod

    if b<=a:

        print((0))

        exit()

    

    ans=mod

    for i in range(a,b+1):

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

            temp=(i*j)%mod

            ans=min(ans,temp)

            

    print(ans)

            



main()

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

import sys

input = sys.stdin.readline


def I():
    return int(eval(input()))


def MI():
    return list(map(int, input().split()))


def LI():
    return list(map(int, input().split()))


def main():
    mod = 2019
    L, R = MI()
    if R - L >= 2019:
        print((0))
        exit()
    a = L % mod
    b = R % mod
    if b <= a:
        print((0))
        exit()
    ans = mod
    for i in range(a, b + 1):
        for j in range(i + 1, b + 1):
            temp = (i * j) % mod
            ans = min(ans, temp)
    print(ans)


main()

-L, R = list(map(int, input().split())) -mod = 2019 -ans = mod -l = L % mod -r = R % mod -if r <= l: -    ans = 0 -elif (R - L) >= 2019: -    ans = 0 -else: -    for i in range(l, r + 1): -        for j in range(i + 1, r + 1): -            ans = min(ans, i * j % mod) -print(ans) +import sys + +input = sys.stdin.readline + + +def I(): +    return int(eval(input())) + + +def MI(): +    return list(map(int, input().split())) + + +def LI(): +    return list(map(int, input().split())) + + +def main(): +    mod = 2019 +    L, R = MI() +    if R - L >= 2019: +        print((0)) +        exit() +    a = L % mod +    b = R % mod +    if b <= a: +        print((0)) +        exit() +    ans = mod +    for i in range(a, b + 1): +        for j in range(i + 1, b + 1): +            temp = (i * j) % mod +            ans = min(ans, temp) +    print(ans) + + +main()