import scala.io.StdIn._
object Main extends App {
  val Array(l, r) = readLine.split(" ").map(_.toLong)
  var min = Long.MaxValue
  for {
    i <- l to math.min(r - 1, l + 2019)
    j <- l + 1 to math.min(r, l + 2019)
  } min = math.min(min, i * j % 2019)
  
  println(min)
}
