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