object Main extends App {

  val Array(l, r) = scala.io.StdIn.readLine().split(" ").map(_.toLong)

  def solve(): Long = {
    var ans = l * r
    for {
      i <- l to r
      j <- i+1 to r
    } yield {
      val mod = i * j % 2019
      if(mod == 0) return 0
      ans = Math.min(ans, mod)
    }
    ans
  }
  println(solve)

}
