def mod2019(x, y)
  ((x % 2019) * (y % 2019)) % 2019
end

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

if (R - L) > 2019 then
  puts 0
  exit
end

r =  R < (L + 2019) ? R : (L + 2019)
minMod = 2019
(L..r).each { |i|
  ((i+1)..r).each { |j|
    modIJ = mod2019(i, j)
    if modIJ < minMod then
      minMod = modIJ
    end
  }
}

puts minMod
