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

mod = 2019

if r - l > 3000:

  print((0))

else:

  ans = mod

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

    for j in range(r, l, -1):

      #print(str(i) + ' ' + str(j))

      if j <= i: break

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

  print(ans)

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

if r - l > 3000:

  print((0))

else:

  ans = 3000

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

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

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

  print(ans)

  

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

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

-mod = 2019 -    ans = mod +    ans = 3000 -        for j in range(r, l, -1): -            # print(str(i) + ' ' + str(j)) -            if j <= i: -                break -            ans = min(ans, (i * j) % mod) +        for j in range(i + 1, r + 1): +            ans = min(ans, i * j % 2019)