fun main(args: Array<String>) {
  var split = readLine()!!.split(" ")
  val L = split[0].toLong()!!
  val R = split[1].toLong()!!
  val a = L / 2019
  val b = R / 2019
  if (a == b) {
    var min: Long = Long.MAX_VALUE
    for (i in L..R-1) {
      for (j in i+1..R) {
        val mod = (i * j) % 2019
        if (mod < min) {
			min = mod
        }
      }
    }
    println(min)
  } else {
    println(0)
  }
}