object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val l, r = sc.nextInt

  def remainderMinimization2019(min: Int, max: Int): Int = {
    val divisor = 2019
    val startBlock = min / divisor
    val endBlock = max / divisor
    val (i, j) = if (startBlock == endBlock) {
      (min, min + 1)
    } else {
      //startBlock < endBlock
      (min, endBlock * divisor)
    }

    (i * j) % divisor
  }

  println(remainderMinimization2019(l, r))
}