L,R=gets.chomp.split(" ").map(&:to_i);
qL=L/2019
qR=R/2019
if(qL<qR)
 print(0)
else
modL=L.modulo(2019)
modR=R.modulo(2019)
min=2019*2019
for j in modL+1..modR
for i in modL..j-1
 x=[(i*j).modulo(2019)].min
end
end
print(x)
end