fun main(args: Array<String>) {
    var lr = readLine()!!.split(" ").map { it.toLong() }.toMutableList()
    var min = 2019L
    if (lr[1] >= lr[0] + 2019) min = 0L
    else {
        var tmp: Long
        for (i in lr[0] until lr[1]) {
            for (j in i + 1 until lr[1] + 1) {
                tmp = (i * j) % 2019L
                if (tmp < min) min = tmp
            }
        }
    }
    println(min)
}
