fun main(args: Array<String>) {
    val (l, r) = readLine()!!.split(" ").map { it.toLong() }
    if (r - l >= 2100) {
        println(0)
        return
    }
    var ans = Long.MAX_VALUE
    for (i in l..r) {
        for (j in (i + 1)..r) {
            if (i * j % 2019 < ans) {
                ans = i * j % 2019
            }
        }
    }
    println(ans)
}