#ABC 133 Remainder Minimization 2019

l, r = [ int(_) for _ in input().split() ]



ls = [2018]



for i in range(l,r):

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

        y = (i*j) % 2019

        if (i*j) % 2019 < min(x%2019 for x in ls):

            ls.append(i*j)

        if y == 0:

            break

    if y == 0:

        break

    

print((min([ x%2019 for x in ls])))
#ABC 133 Remainder Minimization 2019

l, r = [ int(_) for _ in input().split() ]



ls = [2018]



for i in range(l,r):

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

        y = (i*j) % 2019

        if y < min(x for x in ls):

            ls.append(y)

        if y == 0:

            break

    if y == 0:

        break

    

print((min([ x for x in ls])))
# ABC 133 Remainder Minimization 2019
l, r = [int(_) for _ in input().split()]
ls = [2018]
for i in range(l, r):
    for j in range(i + 1, r + 1):
        y = (i * j) % 2019
        if (i * j) % 2019 < min(x % 2019 for x in ls):
            ls.append(i * j)
        if y == 0:
            break
    if y == 0:
        break
print((min([x % 2019 for x in ls])))

# ABC 133 Remainder Minimization 2019
l, r = [int(_) for _ in input().split()]
ls = [2018]
for i in range(l, r):
    for j in range(i + 1, r + 1):
        y = (i * j) % 2019
        if y < min(x for x in ls):
            ls.append(y)
        if y == 0:
            break
    if y == 0:
        break
print((min([x for x in ls])))

-        if (i * j) % 2019 < min(x % 2019 for x in ls): -            ls.append(i * j) +        if y < min(x for x in ls): +            ls.append(y) -print((min([x % 2019 for x in ls]))) +print((min([x for x in ls])))