import scala.math._

// longでrangeの作り方

object Main extends App {

  val YES = "YES"
  val Yes = "Yes"
  val NO = "NO"
  val No = "No"
  ///////////////////////////////////////////

  val sc = new java.util.Scanner(System.in)
  val l, r = sc.nextLong
//  val list = List.fill(n, d)(sc.nextInt)

//  val sorted = (l to r).map(p => (p, p % 2019)).sortBy(_._2)
//  val ans = (sorted.head._1 * sorted(1)._1) % 2019

//  val ans = (l to r).take(2019).combinations(2).foldLeft(2019L)((acc, f) => {
//    val tmp = (f.head * f.last) % 2019
//    if (tmp <= acc) tmp else acc
//  })

  val ans = (l to r).take(2019).combinations(2).map(f => f.head * f.last % 2019).min
  println(ans)
//  val min = if (r - l >= 2019L) 0L
//  else {
//    val candidates = for {
//      i <- l to (r - 1)
//      j <- (i + 1) to r
//    } yield (i * j) % 2019L
//    candidates.min
//  }



  ///////////////////////////////////////////

  def bigIterator(start: BigInt, end: BigInt, step: BigInt = 1) =
    Iterator.iterate(start)(_ + step).takeWhile(_ <= end)

  def lcm(a :Int, b :Int): Int =
    a / gcd(a, b) * b

  def lcm(a :Long, b :Long): Long =
    a / gcd(a, b) * b

  def gcd(a: Int, b: Int): Int =
    if (b == 0) a else gcd(b, a % b)

  def gcd(a: Long, b: Long): Long =
    if (b == 0) a else gcd(b, a % b)

  def setOrUpdated[A, B](a: Map[A, B], key: A, value: B, f: (B, B) => B) =
    a.get(key) match {
      case Some(v) => a.updated(key, f(value, v))
      case _ => a + (key -> value)
    }
}