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

l2,r2=l%2019,r%2019

if l//2019<r//2019:

  print((0))

else:

  k=2019*2019

  for i in range(l,r):

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

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

  print(k)
l, r = [int(i) for i in input().split()]

if r - l > 2019:

    print((0))

else:

    ans = 10 ** 9

    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 = [int(i) for i in input().split()]
l2, r2 = l % 2019, r % 2019
if l // 2019 < r // 2019:
    print((0))
else:
    k = 2019 * 2019
    for i in range(l, r):
        for j in range(i + 1, r + 1):
            k = min(k, i * j % 2019)
    print(k)

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

-l2, r2 = l % 2019, r % 2019 -if l // 2019 < r // 2019: +if r - l > 2019: -    k = 2019 * 2019 -    for i in range(l, r): +    ans = 10**9 +    for i in range(l, r + 1): -            k = min(k, i * j % 2019) -    print(k) +            ans = min(ans, i * j % 2019) +    print(ans)