"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const L = parseInt(arg[0].split(" ")[0]);
    const R = parseInt(arg[0].split(" ")[1]);
    
    let answer = L;
    
    for(let i=L; i<=R; i++) {
        // ぴったりならそこ
        if(i % 2019 === 0) {
            answer = i;
            break;
        }
    }

    console.log((answer * (answer + 1)) % 2019);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));