def main
  l, r = gets.chomp.split(' ').map(&:to_i)

  diff_num = l - r

  min = [2019, 2019]
  l.upto(r) do |num|
    ans = num % 2019
    min << ans
    return 0 if ans.zero?
  end
  
  a = min.sort!.shift
  b = min.shift
  a * b
end

puts main