import scala.io.{StdIn => in}

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

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

  val ans = res
  println(ans)
}