l,r = gets.split.map(&:to_i)

min = 2018
l.upto([r-1, l + 2018].min) do |i|
  imod = i % 2019
  (i+1).upto([r, (i+1) + 2018].min) do |j|
    jmod = j % 2019
    tmp_min = imod * jmod % 2019
    if tmp_min < min
      min = tmp_min
    end
  end
end

puts min