'use strict';
function main(input) {
  const args = input.split(' '),
        L = parseInt(args[0]),
        R = parseInt(args[1]);
  const LMod = L % 2019,
        RMod = R % 2019;
  for (let i = L; i < L+2019 && i < R; ++i) {
    if (i % 2019 === 0) {
      console.log(0);
      return;
    }
  }
  if (LMod > RMod) {
    let tmp = (R-1) % 2019;
    console.log(tmp * RMod);
  } else {
    let tmp = (L+1) % 2019;
    console.log(LMod * tmp)
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));