import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val l = scanner.nextInt()
    val r = scanner.nextInt()
    val limitL = l/2019
    val limitR = r/2019
    //val array = Array(n, {Array(d, {0})})
    if(l <= 2019 && r >= 2019) println(0)
    else if(r < 2019) {
        var min = 2019
        for(i in l..r-1){
            for(j in i+1..r) {
                if (i*j % 2019 < min) min = i*j % 2019
            }
        }
        println(min)
    }
    else {
        for(i in limitL..limitR){
            if(l <= 2019*i && r >= 2019*i) {
                println(0)
                return
            }
        }
        //val tempL = l-(2019*limitL)
        //val tempR = (2019*(limitR+1))-r
        //if(tempL <= tempR) println((l*(l+1))%2019)
        //else println(((r-1)*r)%2019)
        var min = 2019L
        for(i in l..r-1){
            for(j in i+1..r) {
                if (i.toLong() * j.toLong() % 2019L < min) min = i.toLong() * j.toLong() % 2019L
            }
        }
        println(min)
    }
}