function Main(input) {
    L = input.split(' ')[0] * 1
    R = input.split(' ')[1] * 1
    arr = []
    for (i = L; i <= R && i < L + 2019; i++) {
        arr.push(i % 2019)
    }
    arr = arr.sort((a, b) => {
        return a - b
    })
    console.log((arr[0] * arr[1]) % 2019)
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));