L,R=list(map(int,input().split()))

_min=2018

if L==0:

  _min=0

else:  

  for l in range(L,L+2019):

    if l>R:

      break

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

      if r>R:

        break

      m=(l*r)%2019

      if _min>m:

        _min=m

print(_min)    



L,R=list(map(int,input().split()))

_min=2018

if L==0:

  _min=0

elif R-L>=2019:

  _min=0

else:

  for l in range(L,R):

    for r in range(L+1,R+1):

      mm=(l*r)%2019

      if mm==0:

        _min=0

        break

      elif _min>mm:

        _min=mm

print(_min)    



L, R = list(map(int, input().split()))
_min = 2018
if L == 0:
    _min = 0
else:
    for l in range(L, L + 2019):
        if l > R:
            break
        for r in range(l + 1, l + 2020):
            if r > R:
                break
            m = (l * r) % 2019
            if _min > m:
                _min = m
print(_min)

L, R = list(map(int, input().split()))
_min = 2018
if L == 0:
    _min = 0
elif R - L >= 2019:
    _min = 0
else:
    for l in range(L, R):
        for r in range(L + 1, R + 1):
            mm = (l * r) % 2019
            if mm == 0:
                _min = 0
                break
            elif _min > mm:
                _min = mm
print(_min)

+elif R - L >= 2019: +    _min = 0 -    for l in range(L, L + 2019): -        if l > R: -            break -        for r in range(l + 1, l + 2020): -            if r > R: +    for l in range(L, R): +        for r in range(L + 1, R + 1): +            mm = (l * r) % 2019 +            if mm == 0: +                _min = 0 -            m = (l * r) % 2019 -            if _min > m: -                _min = m +            elif _min > mm: +                _min = mm