import itertools



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

if(r - l) > 2019:

    ans = 0

else:

    a = []

    combs = list(itertools.combinations_with_replacement(list(range(l, r + 1)), 2))

    for comb in combs:

        if comb[0] != comb[1]:

            a.append((comb[0]*comb[1]%2019))



    ans = min(a)



print(ans)
import itertools



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

if(r - l) > 2019:

    ans = 0

else:

    ans = 2018

    combs = list(itertools.combinations_with_replacement(list(range(l, r + 1)), 2))

    for comb in combs:

        if comb[0] != comb[1]:

            a = (comb[0] * comb[1]) % 2019

            if ans > a:

                ans = a



print(ans)
import itertools

l, r = list(map(int, input().split()))
if (r - l) > 2019:
    ans = 0
else:
    a = []
    combs = list(itertools.combinations_with_replacement(list(range(l, r + 1)), 2))
    for comb in combs:
        if comb[0] != comb[1]:
            a.append((comb[0] * comb[1] % 2019))
    ans = min(a)
print(ans)

import itertools

l, r = list(map(int, input().split()))
if (r - l) > 2019:
    ans = 0
else:
    ans = 2018
    combs = list(itertools.combinations_with_replacement(list(range(l, r + 1)), 2))
    for comb in combs:
        if comb[0] != comb[1]:
            a = (comb[0] * comb[1]) % 2019
            if ans > a:
                ans = a
print(ans)

-    a = [] +    ans = 2018 -            a.append((comb[0] * comb[1] % 2019)) -    ans = min(a) +            a = (comb[0] * comb[1]) % 2019 +            if ans > a: +                ans = a