fun main(args: Array<String>) {
    val sc = java.util.Scanner(System.`in`)
    val L = sc.nextLong()
    val R = sc.nextLong()


    var t = 99999999999L
    (L..Math.min(R - 1, L + 2020)).map { l1 ->
        (Math.max(L + 1, R - 2020)..R).map { r1 ->
            t = Math.min(t, (l1 * r1) % 2019)
        }
    }

    println(t)
}
