"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const L = parseInt(arg[0].split(" ")[0]);
    const R = parseInt(arg[0].split(" ")[1]);
    
    if(R - L + 1 >= 2019) {
        // 2つの数の差が2019以上のとき、必ず2019の倍数が存在するので0
        console.log(0);
    } else {
        const Lmod = L;
        const Rmod = R;
        
        let min = Infinity;
        
        for(let i=L; i<R; i++) {
            for(let k=parseInt(i)+1; k<=R; k++) {
                min = Math.min((i * k) % 2019, min);
            }
        }
        
        console.log(min);
    }
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
