const main = (L,R) => {
    var result = Math.pow(10,9)
    
    if(R - L >= 2019) {
        return 0
    }
    
    for(var i = L;i<R;i++) {
        for(var j = i+1;j<R+1;j++) {
            result = Math.min(result,i*j% 2019)
            if(result === 0) {
                return result
            }
        }
    }

    return result

}

const input = require('fs').readFileSync('/dev/stdin','utf8').split("\n")[0]
const LR = input.split(" ").map(i => Number(i))
console.log(main(LR[0],LR[1]))