fun main(args: Array<String>) {
  val (L, R) = readLine()!!.split(' ').map { it.toLong() }
  val min = (L .. Math.min(R, L+2019)).map { i -> (i + 1 .. Math.min(R, L+2019)).map { j -> i * j % 2019} }.flatMap { it }.min()
  println(min)
}