"use strict";
    
const main = arg => {
  
  let L = arg.split(" ")[0],
      R = arg.split(" ")[1],
      Lmod = arg.split(" ")[0] % 2019,
      Rmod = arg.split(" ")[1] % 2019;

  let min = 2018;
  if(R - L + 1 >= 2019) {
        console.log(0);
  } else {
    for(let i = Lmod; i <= Rmod; i++){
      for(let j = Lmod; j <= Rmod; j++){
        let num = (i*j) % 2019;
        if( (num < min) && (i < j) ){
          min = num;
        }
      }
    }

    console.log(min);
  }
}

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