'use strict';
function main(input) {
  const args = input.split(' '),
        L = parseInt(args[0]),
        R = parseInt(args[1]);
  const LMod = L % 2019,
        RMod = R % 2019;
  let min = 2018;
  if (R-L >= 2018) {
    console.log(0);
  } else {
    for(let i = LMod; i <= RMod-1; i++) {
      for(let j = i+1; j <= RMod; j++) {
        min = Math.min(min, (i*j) % 2019);
      }
    }
    console.log(min);
  }  
};
main(require("fs").readFileSync("/dev/stdin", "utf8"));