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

m = 2019

if r - l >= 673:

    print((0))

else:

    ans = 2018

    l = l%m

    r = r%m

    for i in range(l, r):

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

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

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

m = 2019

if r - l >= 673:

    print((0))

else:

    ans = 2018

    for i in range(l, r):

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

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

        if ans <= 2:

            break

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

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

-    l = l % m -    r = r % m +        if ans <= 2: +            break