object ABC133C_RemainderMinimization2019 extends App {
  val sc = new java.util.Scanner(System.in)
  val l :Int = sc.nextInt()
  val r :Int = sc.nextInt()
  
  val combinationList: List[Seq[Int]] = (l to r).combinations(2).toList
  val multiList = combinationList.map(x => (x(0) * x(1)) % 2019)
  println(multiList.min)
}
