fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(java.util.Scanner(System.`in`), pw)
    pw.flush()
}

object Problem {
    fun solve(sc: java.util.Scanner, pw: java.io.PrintWriter) {
        val L = sc.next().toLong()
        val R = sc.next().toLong()
        var ans = 2020L
        for (l in (L until R)) {
            for (r in (l + 1)..R) {
                val a = ((l % 2019) * r) % 2019
                if (a == 0L) {
                    pw.println("0")
                    return
                }
                if (ans > a) {
                    ans = a
                }
            }
        }
        pw.println(ans)
    }
}
