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

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