fun main(args: Array<String>) {
    val (L, R) = readLine()!!.split(" ").map(String::toLong)

    if (2019 <= R - L) {
        println(0)
        return
    }

    var min = Long.MAX_VALUE
    for (i in L until R) {
        for (l in L + 1..R) {
            min = Math.min(i * l % 2019, min)
            if (min == 0L) {
                println(0)
                return
            }
        }
    }
    println(min)
}


