object Main extends App {

  val arr: Array[Int] = scala.io.StdIn.readLine().split(" ").map(_.toInt)
  val l = arr(0)
  val r = arr(1)

  val list = for {
    i <- l to r
    j <- l to r
  } yield if(i < j || i != j) i * j else 0

  val list2 = list.toSet.filter(_ != 0)

  val ans = list2.map(v => v % 2019).min

  println(ans)



}