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

if r-l >= 2019
  puts 0
  exit
end

r%=2019
l%=2019

l,r = r,l if r<l

ans = 2500

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

puts ans
