const main = (L,R) => {
    var result = 10**9
    for(var i = L;i<R;i++) {
        for(var j = i+1;j<R;j++) {
            if(i*j%2019 ===0) {
                break
            }
            
            const tmp = i*j% 2019
            if(result > tmp) {
                result=tmp
            }
        }
    }
    if (result === 10**9) {
        return L*R
    }else{
        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]))