process.stdin.resume();
process.stdin.setEncoding('utf8');

var lines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  lines.push(line);
});
reader.on('close', () => {
    const L = lines[0].split(' ')[0] - 0;
    const R = lines[0].split(' ')[1] - 0;
    
    var minMod = Infinity
    for(var i=L; i<=R-1; i++) {
        for(var j=i+1; j<=i+1; j++) {
            const ans = (i * j) % 2019;
            minMod = Math.min(minMod, ans)
        }
    }
    console.log(minMod);
});