l, r = gets.chop.split.map(&:to_i)
 
min_mod = 99999999
 
for i in l..r-1
  for j in i+1..r
    if min_mod > i*j % 2019
      min_mod = i*j % 2019
    end
    if min_mod == 0
      puts 0
      exit
  end
end
 
puts min_mod