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

mod = 2019

d = R - L + 1

c = d // mod 

a = L % mod

b = R % mod

if c >= 2 :

    print((0))

else :

    if a > b :

        print((0))

    else :

        amari = []

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

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

                amari.append(i*j%mod)

        print((min(amari)))



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

if R - L >= 2019 :

    print((0))

else:

    K = []

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

        a = i % 2019

        K.append(a)

    ans = 10**9+7

    size = len(K)

    for x in range(size):

        for y in range(x+1,size):

            o = K[x] * K[y] % 2019

            if o < ans :

                ans = o

    print(ans)
L, R = list(map(int, input().split()))
mod = 2019
d = R - L + 1
c = d // mod
a = L % mod
b = R % mod
if c >= 2:
    print((0))
else:
    if a > b:
        print((0))
    else:
        amari = []
        for i in range(L, R + 1):
            for j in range(i + 1, R + 1):
                amari.append(i * j % mod)
        print((min(amari)))

L, R = list(map(int, input().split()))
if R - L >= 2019:
    print((0))
else:
    K = []
    for i in range(L, R + 1, 1):
        a = i % 2019
        K.append(a)
    ans = 10**9 + 7
    size = len(K)
    for x in range(size):
        for y in range(x + 1, size):
            o = K[x] * K[y] % 2019
            if o < ans:
                ans = o
    print(ans)

-mod = 2019 -d = R - L + 1 -c = d // mod -a = L % mod -b = R % mod -if c >= 2: +if R - L >= 2019: -    if a > b: -        print((0)) -    else: -        amari = [] -        for i in range(L, R + 1): -            for j in range(i + 1, R + 1): -                amari.append(i * j % mod) -        print((min(amari))) +    K = [] +    for i in range(L, R + 1, 1): +        a = i % 2019 +        K.append(a) +    ans = 10**9 + 7 +    size = len(K) +    for x in range(size): +        for y in range(x + 1, size): +            o = K[x] * K[y] % 2019 +            if o < ans: +                ans = o +    print(ans)