fun main(args: Array<String>) {
    val (l, r) = readLine()!!.split(' ').map(String::toInt)
    if (r - l >= 2018) {
        println(0)
    } else {
        var min = 2019
        for (i in l..r) {
            for (j in l until i) {
                val po = (i % 2019) * (j % 2019) % 2019
                min = Math.min(min, po)
            }
        }
        println(min)
    }
}
