const main = (inputs) => {
  var TW = 2019;
  var L = inputs[0].split(" ")[0]-0;
  var R = inputs[0].split(" ")[1]-0;
  var mods = [];
  var thflg = false;  // 3
  var mnsflg = false; // 673
  for(var i=L;i<=R;i++){
    var val = i%TW;
    mods.push(i);
    if(val == 0){
      console.log(0);
      return;
    }else if(val == 3){
      thflg = true;
    }else if(val == 673){
      mnsflg = true;
    }
    if(thflg && mnsflg){
      console.log(0);
      return;
    }
  }
  var ans = TW;
  for(var i=0;i<mods.length;i++)
  for(var j=i+1;j<mods.length;j++){
    ans = Math.min(ans, ((mods[i]%TW)*(mods[j]%TW)));
  }
  console.log(ans);

}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8').trim().split("\n"));
