program l2019
  integer :: l,r
  integer :: i,j,m

  read(*,*) l,r
  m=2019
  if(l-r.lt.2019) then
     do i=l,r-1
        do j=l+1,r
           if(mod(i*j,2019).lt.m) then
              m=mod(i*j,2019)
           endif
           enddo
     enddo
  else
     m=0
  endif
     write(*,'(i0)') m


end program l2019


