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

Lmod, Rmod = L%2019, R%2019

if Lmod < Rmod and (R - L >= 2019):

    print((0))

elif Lmod < Rmod and (R - L < 2019):

    ch_list =[]

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

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

            ch_list.append((i*j)%2019)

    print((min(ch_list)))

elif Lmod > Rmod:

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

Lmod, Rmod = L%2019, R%2019

result = 2019

if Lmod < Rmod and (R - L >= 2019):

    print((0))

elif Lmod < Rmod and (R - L < 2019):

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

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

            if result > (i*j)%2019:

                result = (i*j)%2019

    print(result)

elif Lmod > Rmod:

    print((0))
L, R = list(map(int, (input().split())))
Lmod, Rmod = L % 2019, R % 2019
if Lmod < Rmod and (R - L >= 2019):
    print((0))
elif Lmod < Rmod and (R - L < 2019):
    ch_list = []
    for i in range(L, R, 1):
        for j in range(i + 1, R + 1, 1):
            ch_list.append((i * j) % 2019)
    print((min(ch_list)))
elif Lmod > Rmod:
    print((0))

L, R = list(map(int, (input().split())))
Lmod, Rmod = L % 2019, R % 2019
result = 2019
if Lmod < Rmod and (R - L >= 2019):
    print((0))
elif Lmod < Rmod and (R - L < 2019):
    for i in range(L, R, 1):
        for j in range(i + 1, R + 1, 1):
            if result > (i * j) % 2019:
                result = (i * j) % 2019
    print(result)
elif Lmod > Rmod:
    print((0))

+result = 2019 -    ch_list = [] -            ch_list.append((i * j) % 2019) -    print((min(ch_list))) +            if result > (i * j) % 2019: +                result = (i * j) % 2019 +    print(result)