fun main(args: Array<String>) {

    var (L, R) = readLine()!!.split(" ").map { it.toInt() }
    if (R - L >= 2019) {
        println(0)
        return
    }
    L %= 2019
    R %= 2019
    if (L > R) {
        println(0)
        return
    }

    if (L == 0 || R == 0) {
        println(0)
        return
    }

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

