function Main(input){
  input = input.split("\n");
  inputStr = input[0].split(" ");
  var L = Number.parseInt(inputStr[0]);
  var R = Number.parseInt(inputStr[1]);

  if ( L * R > 2019){
    for ( var i = L+1 ; i < R+1 ; i++){
      if ( L * i > 2019){
        console.log(L * i % 2019);
        break;
      }
    }
  } else {
    console.log(L * (L+1));
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));