import scala.io.StdIn

object Main {

  def main(args: Array[String]): Unit = {
    val Array(l, r) = StdIn.readLine.split(' ').map(_.toLong)
    val m = 2019l
    val r2 = r min (l + m)
    val ijs = for {
      i <- l until r2
      j <- (i + 1) to r2
    } yield (i * j) % m
    println(ijs.min)
  }

}
