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

n = r-l+1

if n >= 2019:

    print((0))

else:

    x = l % 2019

    if x > r%2019:

        print((0))

    else:

        ans = 2018

        for i in range(l,r):

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

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

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

n = r-l+1

l = l%2019

r = r%2019

if n >= 2019:

    print((0))

else:

    if l > r:

        print((0))

    else:

        ans = 2018

        for i in range(l,r):

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

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

        print(ans)
l, r = list(map(int, input().split()))
n = r - l + 1
if n >= 2019:
    print((0))
else:
    x = l % 2019
    if x > r % 2019:
        print((0))
    else:
        ans = 2018
        for i in range(l, r):
            for j in range(i + 1, r + 1):
                ans = min(ans, (j * i) % 2019)
        print(ans)

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

+l = l % 2019 +r = r % 2019 -    x = l % 2019 -    if x > r % 2019: +    if l > r: