import java.util.Scanner

import scala.annotation.tailrec
import scala.collection.mutable.ArrayBuffer


object Main {
  def read() = {
    val sc = new Scanner(System.in)
    val l, r = sc.nextInt()
    (l, r)
  }

  def solve(l: Int, r: Int): Long = {
    val mod = 2019
    // 0~2018が必要条件
    val ml = l % mod
    val mr = r % mod
    // ml <= mr の場合: [ml, mr]の範囲
    // ml > mrの場合: [0, mr], [ml, 2018]
    // 空集合警戒

    val range: IndexedSeq[Int] = if (ml <= mr) ml to mr else IndexedSeq.concat(0 to mr, ml to (mod - 1))
    (for(i<- range; j<- range; if i<j)yield{
      i * j % mod
    }).min
  }

  def main(args: Array[String]): Unit = {
    val (l, r) = read()
    println(solve(l, r))
  }
}