object Main{

def main(args: Array[String]): Unit = {
  val arr1 = io.StdIn.readLine().split(' ')
  val L = arr1(0).toInt
  val R = arr1(1).toInt
  
  val given = 2019 // = 1 x 3 x 673
  val pf1 = 3
  val pf2 = 673
  val res = R - L
  
  if(res >= pf2){
    println("0")
  }else{
    var min = 2019
    (L until R).foreach{
      i =>
      (i + 1 to R).foreach{
        j => 
      val k = (i * j)% 2019
      if(min > k) min = k
      }
    }
    println(min)
  }
}
}