object Main {
  def main(args: Array[String]): Unit = {
    solve
  }

  def solve(): Unit = {
    val sc = new java.util.Scanner(System.in)
    val l, r = sc.nextLong

    val lMod = l % 2019
    val rMod = r % 2019

    if (r - l >= 2019) {
      println(0)
    } else {
      if (lMod <= rMod) println(lMod * (lMod + 1))
      else {
        if (rMod == 0) println(0)
        else println(rMod * lMod)
      }

    }
  }
}
