import java.util.Scanner

var max=2020L
val mod=2019L
fun main(args:Array<String>){
    val sc=Scanner(System.`in`)
    var L=sc.nextLong()
    var R=sc.nextLong()

    for( i in (L+1)..Math.min(L+2019,R)){
        for(j in L..(i-1)){
            max=Math.min(max,i*j%mod)
        }
    }
    println(max)
}