program ccc

implicit none
integer(8) :: l, r, i, one, two

read*, l, r

do i=1,10000
if(l>=2019) then
l=l-2019*i
else
exit
end if
end do

one=l*(l+1)

do i=1,10000
if(r>=2019) then
r=r-2019*i
else
exit
end if
end do

two=r*(r-1)

write(*,'(i0)') min(one,two)

end program