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

if r - l >= 2018:

  print((0))

else:

  ans = 2019

  for i in range(l, r):

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

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

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



ans = 2019

for i in range(l, r):

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

    t = i*j%2019

    if ans > t:

      ans = t

    if ans == 0:

      print(ans)

      exit()

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

l, r = list(map(int, input().split()))
ans = 2019
for i in range(l, r):
    for j in range(i + 1, r + 1):
        t = i * j % 2019
        if ans > t:
            ans = t
        if ans == 0:
            print(ans)
            exit()
print(ans)

-if r - l >= 2018: -    print((0)) -else: -    ans = 2019 -    for i in range(l, r): -        for j in range(i + 1, r + 1): -            ans = min(ans, i * j % 2019) -    print(ans) +ans = 2019 +for i in range(l, r): +    for j in range(i + 1, r + 1): +        t = i * j % 2019 +        if ans > t: +            ans = t +        if ans == 0: +            print(ans) +            exit() +print(ans)