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

# p L.modulo(2019) * R.modulo(2019)

ans = 2019
n = 0
for i in L..R do
  n = i.modulo(2019) * (i+1).modulo(2019)
  if ans > n then
    ans = n
  end
end

p ans