import scala.io.StdIn

object Main extends App {
  val Array(l, r)  = StdIn.readLine().split(" ").map(_.toInt)

  val lm = l % 2019
  val rm = if (r % 2019 < lm) 2018 else r % 2019
  

  println((lm to rm).combinations(2).map{ i => (i(0) * i(1)) % 2019 }.min)

}
  

