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)    



import sys

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

_min=2018

if L==0 or R-L>=2019:

  print((0)) 

  sys.exit()

else:

  for l in range(L,R):

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

      mm=(l*r)%2019

      if mm==0:

        print((0)) 

        sys.exit()

      elif _min>mm:

        _min=mm

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)

import sys

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

+import sys + -if L == 0: -    _min = 0 -elif R - L >= 2019: -    _min = 0 +if L == 0 or R - L >= 2019: +    print((0)) +    sys.exit() -                _min = 0 -                break +                print((0)) +                sys.exit()