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

    if (L/mod != R/mod) {
        println(0)
        return
    }
    L %= mod
    R %= mod

    var min = mod

    for (l in L until R) {
        for (r in l + 1..R) {
            min = Math.min(((l*r)%mod).toInt(), min)
        }
    }
    println(min)
}