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

n = 2019

if R-L >= n:

    print((0))

else:

    L %= n

    R %= n

    if L == 0 or R == 0:

        print((0))

    elif L >= R:

        print((0))

    else:

        numbers = []

        for i in range(R-L):

            for j in range(R-L-i):

                numbers.append( ((L+i) * (L+i+j+1)) % n)

        

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

n = 2019

if R-L >= n or L%n == 0 or R%n == 0 or L%n >= R%n:

    print((0))

else:

    L %= n

    R %= n

    numbers = []

    for i in range(R-L):

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

            numbers.append( ((L+i) * (L+j)) % n )

    print((min(numbers)))
L, R = list(map(int, input().split()))
n = 2019
if R - L >= n:
    print((0))
else:
    L %= n
    R %= n
    if L == 0 or R == 0:
        print((0))
    elif L >= R:
        print((0))
    else:
        numbers = []
        for i in range(R - L):
            for j in range(R - L - i):
                numbers.append(((L + i) * (L + i + j + 1)) % n)
        print((min(numbers)))

L, R = list(map(int, input().split()))
n = 2019
if R - L >= n or L % n == 0 or R % n == 0 or L % n >= R % n:
    print((0))
else:
    L %= n
    R %= n
    numbers = []
    for i in range(R - L):
        for j in range(i + 1, R - L + 1):
            numbers.append(((L + i) * (L + j)) % n)
    print((min(numbers)))

-if R - L >= n: +if R - L >= n or L % n == 0 or R % n == 0 or L % n >= R % n: -    if L == 0 or R == 0: -        print((0)) -    elif L >= R: -        print((0)) -    else: -        numbers = [] -        for i in range(R - L): -            for j in range(R - L - i): -                numbers.append(((L + i) * (L + i + j + 1)) % n) -        print((min(numbers))) +    numbers = [] +    for i in range(R - L): +        for j in range(i + 1, R - L + 1): +            numbers.append(((L + i) * (L + j)) % n) +    print((min(numbers)))