'use strict';

new Promise(function (resolve) {
    var lines = [];
    var reader = require('readline').createInterface({input: process.stdin, output: process.stdout});
    reader.on('line', function (line) {
        lines.push(line.split(' '));
    });
    reader.on('close', function () {
        resolve(lines);
    });
}).then(function (lines) {
    var l = parseInt(lines[0][0], 10);
    var r = parseInt(lines[0][1], 10);
    console.log(search(l, r, 2019));
});

function search(lower, upper, mod) {
    let min_remain = mod;
    for (let i = lower; i <= Math.min(lower + mod - lower % mod, upper - 1); ++i) {
        for (let j = i + 1; j <= Math.min(i + mod, upper); ++j) {
            const remain = i * j % mod;
            // if (remain === 0) {
            //     return 0;
            // }
            if (min_remain > remain) {
                min_remain = remain;
            }
        }
    }
    return min_remain;
}
