const main = (L,R) => {
    if(R-L===1) {
        return L*R
    }else{
        return (L*(L+1))%2019
    }

}

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]))