fun main(args:Array<String>){
    val mod = 2019
    val line = readLine()!!.split(" ").map{it.toInt()}
    val l = line[0]
    val r = line[1]
    var min = 2019
    if(r-l > 2020){
        println(0)
        return
    }
    for(i in l..r-1){
        for(ii in l+1..r){
            val num = (i%mod)*(ii%mod)%mod
            if(num<min){
                min = num
            }
        }
    }
    println(min)
    return
}