fun main(args: Array<String>)
{
    val (l, r)  =readNInts()

    if (r - l + 1 >= 2019)
    {
        println(0)
    }
    else
    {
        var ans = 10000L
        for (i in l until r) {
            for (k in i+1..r) {
                val rem = (i * k) % 2019
                ans = if (ans > rem) rem else ans
            }
        }

        println(ans)
    }
}


// Read an integer
// Usage: val a = readInt()
private fun readInt() = readLine()!!.toInt()

// Read N integers separated by " "
// Usage: val (a, b, c) = readNInts()
private fun readNInts() = readLine()!!.split(" ").map(String::toLong)

// Read a string
// Usage: val a = readString()
private fun readString() = readLine()!!
