( L, R ) = gets.split(' ').map(&:to_i)
a = R - L
if a > 2019
  puts 0
else
  ret = 2019
  (L..R).each{|i|
    (L..R).each{|j|
      if i != j
        ret = i * j % 2019 < ret ? i * j % 2019 : ret 
      end
    }
  }
  puts ret
end