# frozen_string_literal: true

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

min = 4 * 10**18 + 1
if r >= l + 2018
  puts 0
else
  l.upto(r - 1) do |i|
    (i + 1).upto(r) do |j|
      m = (i * j) % 2019
      min = m if min > m
    end
  end
  puts min
end
