fun main(args: Array<String>) = println(run {
    val (l, r) = readLine()!!.split(" ").map { it.toInt() }

    if (r - l >= 2019) return@run 0

    (l..r-1).map { i ->
        (i+1..r).map { j ->
            ((i%2019) * (j%2019)) % 2019
        }.min()!!
    }.min()!!

})