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

P = min(R, L+2018)

c = []

for i in range(L,P+1):

  for j in range(L,P+1):

    if i != j:

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

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

c = 2018

for i in range(L,R):

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

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

    if (i*j)%2019 == 0:

      print(c)

      exit()

print(c)      

# 解説をみてから回答
L, R = list(map(int, input().split()))
P = min(R, L + 2018)
c = []
for i in range(L, P + 1):
    for j in range(L, P + 1):
        if i != j:
            c.append((i * j) % 2019)
print((min(c)))

L, R = list(map(int, input().split()))
c = 2018
for i in range(L, R):
    for j in range(i + 1, R + 1):
        c = min(c, (i * j) % 2019)
        if (i * j) % 2019 == 0:
            print(c)
            exit()
print(c)
# 解説をみてから回答

-P = min(R, L + 2018) -c = [] -for i in range(L, P + 1): -    for j in range(L, P + 1): -        if i != j: -            c.append((i * j) % 2019) -print((min(c))) +c = 2018 +for i in range(L, R): +    for j in range(i + 1, R + 1): +        c = min(c, (i * j) % 2019) +        if (i * j) % 2019 == 0: +            print(c) +            exit() +print(c) +# 解説をみてから回答