l, r = gets.split(" ").map(&:to_i)
ans = []
mod = 2019

if mod*2 <= r
  puts "0"
else
  for i in l..r do
    for j in l..r do
      if i < j
        ans << (i * j) % mod
      end
    end
  end
  puts ans.min
end