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

count = 0

arr = []
l.upto(r) do |i|
  count += 1
  break if count > 2019
  arr << i
end
min = (arr[0] * arr[1])%2019
arr.combination(2) do |a,b|
  n = (a * b)%2019
  min = n if n < min
end

puts min