function main(input){
  const L = parseInt(input.split(" ")[0],10);
  const R = parseInt(input.split(" ")[1],10);
  var arr=[];
  
  var LL = (L%2019);
  if( (L%2019) < (R%2019) ){
    var RR=R%2019;
  }else{
    var RR=(R%2019)+2019;
  }

  for(var i=LL; i<RR; i++){
    for(var j=i+1; j<=RR; j++){
      var temp = ((i%2019)*(j%2019)) % 2019;
      if(temp==0){
        arr.push(temp);
        break;
      }else if(arr.indexOf(temp)==-1){
        arr.push(temp);
      }
    }
  }
  console.log(Math.min.apply(null,arr));
}

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