L, R = gets.split.map(&:to_i)
(puts 0; exit) if R - L >= 2019 - L % 2019

array = (L..R).to_a

min = 2018
array.combination(2) do |a, b|
  break if min == 0
  mod = (a * b) % 2019
  min = mod if mod < min
end

puts min