import scala.io.{StdIn => in}

object Main extends App {
  val mod = 2019L
  val Array(l, r) = in.readLine.split(" ").map(_.toLong)

  val r2 = r min (l+mod*2)
  var res:Long = Integer.MAX_VALUE
  for {
    i <- l to r2
    j <- i+1 to r2
  } {
    val x = (i*j) % mod
    if(res > x) res = x
  }

  val ans = res
  println(ans)
}