import java.util.*

fun main(args:Array<String>){
    val (l,r) = readLine()!!.split(" ").map{it.toLong()}
    var ans = 2020L
    val n = Math.min(r, l + 2020)
    for(i in l .. n){
        for(j in i + 1 .. n){
            ans = Math.min(ans, i % 2019 * j % 2019)
        }
    }
    println(ans)
}