def fin(x)
  puts x
  exit
end

L, R = gets.strip.split.map(&:to_i)


res = 2019
for i in L..R-1
#(L..(R - 1)).each do |i| 
  #((i + 1)..R).each do |j|
  for j in i+1..R
    #tmp = (i * j) % 2019
    #res = tmp if tmp < res
    if res > i*j % 2019
      res = i*j % 2019
    end
  end
  fin(0) if res == 0
  #fin(0) if res.zero?
end

 
# min_mod = 2019
#  
# 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
# end

puts res
