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

  divided_num = 2019

  candidate_nums = [*l..r]
  
  min = 2020
  1.upto(candidate_nums.size-1) do |i|
    ans = (candidate_nums[i-1] * candidate_nums[i]) % 2019
    min = ans if ans < min
    return 0 if min.zero?
  end
  return min
end

puts main