import scala.io.{StdIn => in}

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

  var res = Int.MaxValue + 1L
  for{
    i <- 0L until mod
    if l + i < r
    j <- (i + 1L) until (i + 1L + mod * 2)
    if l + j <= r
  } {
    val v = ((l+i) % mod) * ((l+j) % mod)
    if(res > v) res = v
  }

  val ans = res
  println(ans)
}