import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val l = sc.nextLong()
  val r = sc.nextLong()

  var ans = Long.MAX_VALUE
  for (i in l..r-1) {
    for (j in l+1L..r) {
      val ij = i * j
      val tmp = ij % 2019L
      if (tmp == 0L) {
        println(0)
        return
      }
      if (tmp < ans) {
        ans = tmp
      }

    }
  }
  println(ans)
}
