import java.util.*;
fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val L = sc.nextLong()
    val R = sc.nextLong()
    
    if(R-L>2019){
        println(0);
    }
    else{
    	var ans:Long=2000000000000000000
        for(i in L..R){
            for(j in i+1..R){
                var tmp:Long=i*j
                ans=Math.min(tmp%2019,ans)
            }
        }
        println(ans)
    }
}