fun main(args: Array<String>) {
    var (L, R) = listOfLong()
    R = Math.min(R, L + 2019)
    var ans = Long.MAX_VALUE
    for (i in L .. R-1) {
        for (j in i+1 .. R) {
            ans = Math.min(ans, (i * j) % 2019)
        }
    }
    println(ans)
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfLong(delta: Long = 0L) = listOfString().map { it.toLong() + delta }
