import itertools

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



if r-l >= 2018:

  print((0))

else:

  l_mod = l%2019

  r_mod = r%2019

  min_mod = float('inf')

  if l_mod <= r_mod:

    for c in itertools.combinations(list(range(l_mod, r_mod+1)), 2):

      min_mod = min(min_mod, (c[0]*c[1])%2019)

    print(min_mod)

  else:

    print((0))



    





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

if r-l+1 >= 2019:

    print((0))

else:

    l %= 2019

    r %= 2019

    if l <= r:

        ans = float('inf')

        for i in range(l, r):

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

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

    else:

        ans = 0

    print(ans)
import itertools

l, r = list(map(int, input().split()))
if r - l >= 2018:
    print((0))
else:
    l_mod = l % 2019
    r_mod = r % 2019
    min_mod = float("inf")
    if l_mod <= r_mod:
        for c in itertools.combinations(list(range(l_mod, r_mod + 1)), 2):
            min_mod = min(min_mod, (c[0] * c[1]) % 2019)
        print(min_mod)
    else:
        print((0))

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

-import itertools - -if r - l >= 2018: +if r - l + 1 >= 2019: -    l_mod = l % 2019 -    r_mod = r % 2019 -    min_mod = float("inf") -    if l_mod <= r_mod: -        for c in itertools.combinations(list(range(l_mod, r_mod + 1)), 2): -            min_mod = min(min_mod, (c[0] * c[1]) % 2019) -        print(min_mod) +    l %= 2019 +    r %= 2019 +    if l <= r: +        ans = float("inf") +        for i in range(l, r): +            for j in range(i + 1, r + 1): +                ans = min(ans, (i * j) % 2019) -        print((0)) +        ans = 0 +    print(ans)