# frozen_string_literal: true

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

l.upto([l + 2018, r].min) do |i|
  (i + 1).upto([i + 2019, r].min) do |j|
    min = [i * j % 2019, min].min
  end
end

puts min