object Main {
  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val l, r = sc.nextInt
    sc.close

    val j = 2019 < r match {
      case true => 2020
      case _    => r
    }
    val i = 2019 < l match {
      case true => j + 1
      case _ => {
        if (l < j - 1) l + 1
        else l
      }
    }

    val ij = i * j
    println((math.floor(ij % 2019)).toInt)
  }
}