mod = 2019

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



if r//mod - l//mod > 0:

  print((0))

else:

  l %= mod

  r %= mod

  ans = mod - 1

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

    for j in range(l, i):

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

  print(ans)
mod = 2019

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



if r//mod - l//mod > 0:

  print((0))

else:

  l %= mod

  r %= mod

  ans = mod

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

    for j in range(l, i):

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

    if ans == 0:

      break

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

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

-    ans = mod - 1 +    ans = mod +        if ans == 0: +            break